diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bc03764..21358f0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,43 +9,42 @@ on: title: required: true description: Release title + image_tag: + type: choice + required: true + description: Image multiversx/sdk-rust-contract-builder + options: + - v3.1.0 + - v4.0.2 + - v4.0.3 permissions: contents: write -env: - # https://github.com/actions/runner/issues/863 ($HOME is overridden for containers) - ELROND_HOME: /home/elrond - REPO_PATH: /home/elrond/sc-nft-marketplace - REPO_URL: https://github.com/ElrondNetwork/sc-nft-marketplace.git - jobs: build: runs-on: ubuntu-latest - # See: https://docs.github.com/en/actions/using-jobs/running-jobs-in-a-container - container: - image: elrondnetwork/elrond-sdk-erdpy-rust:frozen-003 steps: - # We don't use actions/checkout, since we want to control the location of the repository, - # in order to achieve deterministic builds. - - name: Check out code - run: | - echo "Cloning ref: $GITHUB_REF_NAME" - cd $ELROND_HOME && git clone $REPO_URL --branch=$GITHUB_REF_NAME --depth=1 + - name: Checkout + uses: actions/checkout@v2 + with: + ref: ${{ env.GITHUB_REF_NAME }} + fetch-depth: 0 + repository: ${{ env.GITHUB_REPOSITORY }} - - name: Build WASM files + - name: Download build script run: | - # Setting $HOME is required by erdpy. - export HOME=$ELROND_HOME - cd $REPO_PATH && bash ./build-wasm.sh - + wget https://raw.githubusercontent.com/multiversx/mx-sdk-rust-contract-builder/${{ github.event.inputs.image_tag }}/build_with_docker.py + - name: Build contract + run: | + python3 ./build_with_docker.py --no-docker-tty --image=multiversx/sdk-rust-contract-builder:${{ github.event.inputs.image_tag }} --project=. --output=/home/runner/work/output-from-docker - name: Save artifacts uses: actions/upload-artifact@v2 with: name: built-contracts path: | - ${{ env.REPO_PATH }}/**/output/*.wasm - ${{ env.REPO_PATH }}/**/output/*.abi.json + /home/runner/work/output-from-docker/**/*.wasm + /home/runner/work/output-from-docker/**/*.abi.json if-no-files-found: error release: @@ -66,15 +65,15 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - echo "## Checksums (blake2b):" >> notes.txt + echo "Built using Docker image: **multiversx/sdk-rust-contract-builder:${{ github.event.inputs.image_tag }}**." >> notes.txt echo "" >> notes.txt - - for i in $(find ./assets -type f); do + echo "## Codehash (blake2b):" >> notes.txt + echo "" >> notes.txt + for i in $(find ./assets -type f -name *.wasm); do filename=$(basename ${i}) checksum=($(b2sum -l 256 ${i})) echo " - **${filename}**: \`${checksum}\`" >> notes.txt done - gh release create ${{ github.event.inputs.tag }} --target=$GITHUB_SHA --prerelease --title="${{ github.event.inputs.title }}" --generate-notes --notes-file=notes.txt sleep 10 gh release upload ${{ github.event.inputs.tag }} $(find ./assets -type f)