Add polkadot-bulletin-chain binary to release workflow (#190) #11
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - v* | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-runtimes: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - name: bulletin-westend | |
| package: bulletin-westend-runtime | |
| path: runtimes/bulletin-westend | |
| - name: bulletin-polkadot | |
| package: bulletin-polkadot-runtime | |
| path: runtimes/bulletin-polkadot | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Build ${{ matrix.name }} runtime | |
| id: srtool_build | |
| uses: chevdor/[email protected] | |
| env: | |
| BUILD_OPTS: "--features on-chain-release-build" | |
| with: | |
| chain: ${{ matrix.name }} | |
| package: ${{ matrix.package }} | |
| runtime_dir: ${{ matrix.path }} | |
| profile: production | |
| - name: Store srtool digest | |
| run: | | |
| echo '${{ steps.srtool_build.outputs.json }}' | jq > ${{ matrix.name }}_srtool_output.json | |
| - name: Upload ${{ matrix.name }} wasm | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.name }}-runtime | |
| path: | | |
| ${{ steps.srtool_build.outputs.wasm_compressed }} | |
| ${{ matrix.name }}_srtool_output.json | |
| build-node: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown | |
| components: rust-src | |
| - name: Install system dependencies | |
| run: | | |
| sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list /etc/apt/sources.list.d/azure-cli.list | |
| sudo apt-get update | |
| sudo apt-get install -y protobuf-compiler libclang-dev | |
| - name: Build polkadot-bulletin-chain binary | |
| run: cargo build --profile production -p polkadot-bulletin-chain | |
| - name: Upload polkadot-bulletin-chain binary | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: polkadot-bulletin-chain | |
| path: target/production/polkadot-bulletin-chain | |
| publish-release: | |
| runs-on: ubuntu-latest | |
| needs: [build-runtimes, build-node] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Prepare release assets | |
| run: | | |
| mkdir -p release-assets | |
| find artifacts -name "*.wasm" -exec cp {} release-assets/ \; | |
| cp artifacts/polkadot-bulletin-chain/polkadot-bulletin-chain release-assets/ | |
| ls -la release-assets/ | |
| - name: Add runtime info to changelog | |
| run: | | |
| CONTEXT=$(find . -name '*_srtool_output.json') | |
| SRTOOL() { <$(<<<$CONTEXT head -n1) jq -r .$1; } | |
| WASM() { <${JSON} jq -r ".runtimes.compressed.subwasm.$1"; } | |
| tee RELEASE_NOTES.md <<-EOF | |
| # Runtime info | |
| *These runtimes were built with **$(SRTOOL rustc)** using **[$(SRTOOL gen)](https://github.com/paritytech/srtool)*** | |
| EOF | |
| for JSON in $(<<<$CONTEXT sort -sr) | |
| do | |
| RUNTIME_NAME=$(basename ${JSON} _srtool_output.json) | |
| tee -a RELEASE_NOTES.md <<-EOF | |
| ## ${RUNTIME_NAME} | |
| ~~~ | |
| 🏋️ Runtime Size: $(numfmt --to iec-i --format "%.2f" $(WASM size)) ($(WASM size) bytes) | |
| 🗜 Compressed: $(WASM 'compression | if .compressed then "Yes: \(1 - .size_compressed / .size_decompressed | . * 10000 | round / 100)%" else "No" end') | |
| 🔥 Core Version: $(WASM 'core_version | "\(.specName)-\(.specVersion) \(.implName)-\(.implVersion).tx\(.transactionVersion).au\(.authoringVersion)"') | |
| 🎁 Metadata version: V$(WASM metadata_version) | |
| 🗳️ Blake2-256 hash: $(WASM blake2_256) | |
| 📦 IPFS: $(WASM ipfs_hash) | |
| ~~~ | |
| EOF | |
| done | |
| cat RELEASE_NOTES.md | |
| - name: Create release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| release-assets/*.wasm | |
| release-assets/polkadot-bulletin-chain | |
| body_path: RELEASE_NOTES.md |