Skip to content

Create release with node binaries #20

Create release with node binaries

Create release with node binaries #20

name: Create release with node binaries
on:
workflow_dispatch:
inputs:
name:
description: 'Release name (v9.3.0 - Antioch)'
required: true
tag:
description: 'Tag (v9.3.0)'
required: true
env:
REPOSITORY: joystream/node
jobs:
build-mac-binary:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- id: compute_shasum
name: Compute runtime code shasum
run: |
export RUNTIME_CODE_SHASUM=`scripts/runtime-code-shasum.sh`
echo "::set-output name=shasum::${RUNTIME_CODE_SHASUM}"
- name: Run Setup
run: |
./setup.sh
- name: Build binaries
run: |
yarn cargo-build
- name: Tar the binary
run: |
tar czvf joystream-node-macos.tar.gz -C ./target/release joystream-node
- name: Temporarily save node binary
uses: actions/upload-artifact@v3
with:
name: joystream-node-macos-${{ steps.compute_shasum.outputs.shasum }}
path: joystream-node-macos.tar.gz
retention-days: 1
create-release:
runs-on: ubuntu-latest
needs: build-mac-binary
steps:
- name: Checkout
uses: actions/checkout@v3
- id: compute_shasum
name: Compute runtime code shasum
run: |
export RUNTIME_CODE_SHASUM=`scripts/runtime-code-shasum.sh`
echo "::set-output name=shasum::${RUNTIME_CODE_SHASUM}"
- id: extract_binaries
name: Copy binaries & wasm file from docker images
run: |
IMAGE=${{ env.REPOSITORY }}:${{ steps.compute_shasum.outputs.shasum }}
docker run -d --entrypoint tail --name temp-container-joystream-node $IMAGE-amd64 -f /dev/null
RESULT=`docker exec temp-container-joystream-node b2sum -l 256 runtime.compact.compressed.wasm | awk '{print $1}'`
VERSION_AND_COMMIT=`docker exec temp-container-joystream-node /joystream/node --version | awk '{print $2}' | cut -d- -f -2`
echo "::set-output name=blob_hash::${RESULT}"
echo "::set-output name=version_and_commit::${VERSION_AND_COMMIT}"
docker cp temp-container-joystream-node:/joystream/runtime.compact.compressed.wasm ./joystream_runtime_${{ github.event.inputs.tag }}.wasm
docker cp temp-container-joystream-node:/joystream/node ./joystream-node
tar -czvf joystream-node-$VERSION_AND_COMMIT-x86_64-linux-gnu.tar.gz joystream-node
docker rm --force temp-container-joystream-node
docker cp `docker create --rm $IMAGE-arm64`:/joystream/node ./joystream-node
tar -czvf joystream-node-$VERSION_AND_COMMIT-arm64-linux-gnu.tar.gz joystream-node
- name: Retrieve saved MacOS binary
uses: actions/download-artifact@v3
with:
name: joystream-node-macos-${{ steps.compute_shasum.outputs.shasum }}
- name: Rename MacOS binary and tar
run: |
mv joystream-node-macos.tar.gz joystream-node-${{ steps.extract_binaries.outputs.version_and_commit }}-x86_64-macos.tar.gz
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
*.tar.gz
*.wasm
tag_name: ${{ github.event.inputs.tag }}
name: ${{ github.event.inputs.name }}
draft: true
body: 'Verify wasm hash:
```
$ b2sum -l 256 joystream_runtime_${{ github.event.inputs.tag }}.wasm
```
This should be the output
```
${{ steps.extract_binaries.outputs.blob_hash }}
```
'