create-release.yml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. ./scripts/raspberry-cross-build.sh
  57. - name: Tar the binary
  58. run: |
  59. tar czvf joystream-node-rpi.tar.gz -C ./target/arm-unknown-linux-gnueabihf/release joystream-node
  60. - name: Temporarily save node binary
  61. uses: actions/upload-artifact@v2
  62. with:
  63. name: joystream-node-rpi-${{ steps.compute_shasum.outputs.shasum }}
  64. path: joystream-node-rpi.tar.gz
  65. retention-days: 1
  66. create-release:
  67. runs-on: ubuntu-latest
  68. needs: [build-mac-binary, build-rpi-binary]
  69. steps:
  70. - name: Checkout
  71. uses: actions/checkout@v2
  72. - id: compute_shasum
  73. name: Compute runtime code shasum
  74. run: |
  75. export RUNTIME_CODE_SHASUM=`scripts/runtime-code-shasum.sh`
  76. echo "::set-output name=shasum::${RUNTIME_CODE_SHASUM}"
  77. - id: extract_binaries
  78. name: Copy binaries & wasm file from docker images
  79. run: |
  80. IMAGE=${{ env.REPOSITORY }}:${{ steps.compute_shasum.outputs.shasum }}
  81. docker run -d --entrypoint tail --name temp-container-joystream-node $IMAGE-amd64 -f /dev/null
  82. RESULT=$(docker exec temp-container-joystream-node b2sum -l 256 runtime.compact.wasm | awk '{print $1}')
  83. VERSION_AND_COMMIT=$(docker exec temp-container-joystream-node /joystream/node --version | awk '{print $2}' | cut -d- -f -2)
  84. echo "::set-output name=blob_hash::${RESULT}"
  85. echo "::set-output name=version_and_commit::${VERSION_AND_COMMIT}"
  86. docker cp temp-container-joystream-node:/joystream/runtime.compact.wasm ./joystream_runtime_${{ github.event.inputs.tag }}.wasm
  87. docker cp temp-container-joystream-node:/joystream/node ./joystream-node
  88. tar -czvf joystream-node-$VERSION_AND_COMMIT-x86_64-linux-gnu.tar.gz joystream-node
  89. docker rm --force temp-container-joystream-node
  90. docker cp $(docker create --rm $IMAGE-arm64):/joystream/node ./joystream-node
  91. tar -czvf joystream-node-$VERSION_AND_COMMIT-arm64-linux-gnu.tar.gz joystream-node
  92. docker cp $(docker create --rm $IMAGE-arm):/joystream/node ./joystream-node
  93. tar -czvf joystream-node-$VERSION_AND_COMMIT-armv7-linux-gnu.tar.gz joystream-node
  94. - name: Retrieve saved MacOS binary
  95. uses: actions/download-artifact@v2
  96. with:
  97. name: joystream-node-macos-${{ steps.compute_shasum.outputs.shasum }}
  98. - name: Retrieve saved RPi binary
  99. uses: actions/download-artifact@v2
  100. with:
  101. name: joystream-node-rpi-${{ steps.compute_shasum.outputs.shasum }}
  102. - name: Rename MacOS and RPi tar
  103. run: |
  104. mv joystream-node-macos.tar.gz joystream-node-${{ steps.extract_binaries.outputs.version_and_commit }}-x86_64-macos.tar.gz
  105. mv joystream-node-rpi.tar.gz joystream-node-${{ steps.extract_binaries.outputs.version_and_commit }}-rpi.tar.gz
  106. - name: Release
  107. uses: softprops/action-gh-release@v1
  108. with:
  109. files: |
  110. *.tar.gz
  111. *.wasm
  112. tag_name: ${{ github.event.inputs.tag }}
  113. name: ${{ github.event.inputs.name }}
  114. draft: true
  115. body: 'Verify wasm hash:
  116. ```
  117. $ b2sum -l 256 joystream_runtime_${{ github.event.inputs.tag }}.wasm
  118. ```
  119. This should be the output
  120. ```
  121. ${{ steps.extract_binaries.outputs.blob_hash }}
  122. ```
  123. '