create-release.yml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. name: Create release with node binaries
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. name:
  6. description: 'Release name (v9.3.0 - Antioch)'
  7. required: true
  8. tag:
  9. description: 'Tag (v9.3.0)'
  10. required: true
  11. env:
  12. REPOSITORY: joystream/node
  13. jobs:
  14. build-mac-binary:
  15. runs-on: macos-latest
  16. steps:
  17. - name: Checkout
  18. uses: actions/checkout@v2
  19. - id: compute_shasum
  20. name: Compute runtime code shasum
  21. run: |
  22. export RUNTIME_CODE_SHASUM=`scripts/runtime-code-shasum.sh`
  23. echo "::set-output name=shasum::${RUNTIME_CODE_SHASUM}"
  24. - name: Run Setup
  25. run: |
  26. ./setup.sh
  27. - name: Build binaries
  28. run: |
  29. yarn cargo-build
  30. - name: Tar the binary
  31. run: |
  32. tar czvf joystream-node-macos.tar.gz -C ./target/release joystream-node
  33. - name: Temporarily save node binary
  34. uses: actions/upload-artifact@v2
  35. with:
  36. name: joystream-node-macos-${{ steps.compute_shasum.outputs.shasum }}
  37. path: joystream-node-macos.tar.gz
  38. retention-days: 1
  39. build-rpi-binary:
  40. runs-on: ubuntu-latest
  41. steps:
  42. - name: Checkout
  43. uses: actions/checkout@v2
  44. - id: compute_shasum
  45. name: Compute runtime code shasum
  46. run: |
  47. export RUNTIME_CODE_SHASUM=`scripts/runtime-code-shasum.sh`
  48. echo "::set-output name=shasum::${RUNTIME_CODE_SHASUM}"
  49. - name: Run Setup
  50. run: |
  51. ./setup.sh
  52. - name: Build binaries
  53. run: |
  54. export WORKSPACE_ROOT=`cargo metadata --offline --no-deps --format-version 1 | jq .workspace_root -r`
  55. sudo chmod a+w $WORKSPACE_ROOT
  56. sudo chmod -R a+w $HOME/.cargo/registry
  57. ./scripts/raspberry-cross-build.sh
  58. - name: Tar the binary
  59. run: |
  60. tar czvf joystream-node-rpi.tar.gz -C ./target/arm-unknown-linux-gnueabihf/release joystream-node
  61. - name: Temporarily save node binary
  62. uses: actions/upload-artifact@v2
  63. with:
  64. name: joystream-node-rpi-${{ steps.compute_shasum.outputs.shasum }}
  65. path: joystream-node-rpi.tar.gz
  66. retention-days: 1
  67. create-release:
  68. runs-on: ubuntu-latest
  69. needs: [build-mac-binary, build-rpi-binary]
  70. steps:
  71. - name: Checkout
  72. uses: actions/checkout@v2
  73. - id: compute_shasum
  74. name: Compute runtime code shasum
  75. run: |
  76. export RUNTIME_CODE_SHASUM=`scripts/runtime-code-shasum.sh`
  77. echo "::set-output name=shasum::${RUNTIME_CODE_SHASUM}"
  78. - id: extract_binaries
  79. name: Copy binaries & wasm file from docker images
  80. run: |
  81. IMAGE=${{ env.REPOSITORY }}:${{ steps.compute_shasum.outputs.shasum }}
  82. docker run -d --entrypoint tail --name temp-container-joystream-node $IMAGE-amd64 -f /dev/null
  83. RESULT=$(docker exec temp-container-joystream-node b2sum -l 256 runtime.compact.wasm | awk '{print $1}')
  84. VERSION_AND_COMMIT=$(docker exec temp-container-joystream-node /joystream/node --version | awk '{print $2}' | cut -d- -f -2)
  85. echo "::set-output name=blob_hash::${RESULT}"
  86. echo "::set-output name=version_and_commit::${VERSION_AND_COMMIT}"
  87. docker cp temp-container-joystream-node:/joystream/runtime.compact.wasm ./joystream_runtime_${{ github.event.inputs.tag }}.wasm
  88. docker cp temp-container-joystream-node:/joystream/node ./joystream-node
  89. tar -czvf joystream-node-$VERSION_AND_COMMIT-x86_64-linux-gnu.tar.gz joystream-node
  90. docker rm --force temp-container-joystream-node
  91. docker cp $(docker create --rm $IMAGE-arm64):/joystream/node ./joystream-node
  92. tar -czvf joystream-node-$VERSION_AND_COMMIT-arm64-linux-gnu.tar.gz joystream-node
  93. docker cp $(docker create --rm $IMAGE-arm):/joystream/node ./joystream-node
  94. tar -czvf joystream-node-$VERSION_AND_COMMIT-armv7-linux-gnu.tar.gz joystream-node
  95. - name: Retrieve saved MacOS binary
  96. uses: actions/download-artifact@v2
  97. with:
  98. name: joystream-node-macos-${{ steps.compute_shasum.outputs.shasum }}
  99. - name: Retrieve saved RPi binary
  100. uses: actions/download-artifact@v2
  101. with:
  102. name: joystream-node-rpi-${{ steps.compute_shasum.outputs.shasum }}
  103. - name: Rename MacOS and RPi tar
  104. run: |
  105. mv joystream-node-macos.tar.gz joystream-node-${{ steps.extract_binaries.outputs.version_and_commit }}-x86_64-macos.tar.gz
  106. mv joystream-node-rpi.tar.gz joystream-node-${{ steps.extract_binaries.outputs.version_and_commit }}-rpi.tar.gz
  107. - name: Release
  108. uses: softprops/action-gh-release@v1
  109. with:
  110. files: |
  111. *.tar.gz
  112. *.wasm
  113. tag_name: ${{ github.event.inputs.tag }}
  114. name: ${{ github.event.inputs.name }}
  115. draft: true
  116. body: 'Verify wasm hash:
  117. ```
  118. $ b2sum -l 256 joystream_runtime_${{ github.event.inputs.tag }}.wasm
  119. ```
  120. This should be the output
  121. ```
  122. ${{ steps.extract_binaries.outputs.blob_hash }}
  123. ```
  124. '