Publish Release #488
Workflow file for this run
This file contains 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: Publish Release | |
# This script is used to build and publish the release WASM build of Acala runtime: | |
# - Checkout the selected branch | |
# - Build WASM using Substrate Runtime Tool | |
# - Use subwasm to obtain build data | |
# - Generate release note | |
# - Create release issue | |
# - Archive the build artifacts to Github | |
# - Publish the WASM to Pinata via ipfs | |
on: | |
create: | |
workflow_dispatch: | |
inputs: | |
# Get name of the chain | |
chain: | |
description: Chain Runtime (default = karura) | |
required: true | |
default: karura | |
type: choice | |
options: | |
- karura | |
- acala | |
# Get the SR Tool image used to build | |
srtool_image: | |
description: Default to use the latest. You can use an alternate image, use with caution! | |
required: false | |
env: | |
SUBWASM_VERSION: 0.21.3 | |
CHAIN: ${{ github.event.inputs.chain }} | |
jobs: | |
build-release: | |
name: Build and publish ${{ github.event.inputs.chain || github.ref }} | |
runs-on: ubuntu-latest | |
# Skip non-release branches | |
if: startsWith(github.ref_name, 'release-') | |
steps: | |
# Checkout the Acala codebase | |
- name: Checkout Codebase | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- name: Setup ENV | |
if: ${{ env.CHAIN == '' }} | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const regex = /release-(karura|acala)-(\d+\.\d+\.\d+)/ | |
const branch = context.ref | |
const [chain] = branch.match(regex).slice(1) | |
core.exportVariable("CHAIN", chain) | |
# Build WASM with Substrate Runtime Tool | |
- name: Srtool build | |
id: srtool_build | |
uses: chevdor/[email protected] | |
env: | |
BUILD_OPTS: "--features on-chain-release-build,no-metadata-docs" | |
with: | |
chain: ${{ env.CHAIN }} | |
tag: ${{ github.event.inputs.srtool_image }} | |
profile: production | |
# Output the build summary | |
- name: Build Summary | |
run: | | |
echo '${{ steps.srtool_build.outputs.json }}' | jq . > ${{ env.CHAIN }}-srtool-digest.json | |
cat ${{ env.CHAIN }}-srtool-digest.json | |
echo "Runtime location: ${{ steps.srtool_build.outputs.wasm }}" | |
# install subwasm | |
- name: Install subwasm ${{ env.SUBWASM_VERSION }} | |
run: | | |
wget https://github.com/chevdor/subwasm/releases/download/v${{ env.SUBWASM_VERSION }}/subwasm_linux_amd64_v${{ env.SUBWASM_VERSION }}.deb | |
sudo dpkg -i subwasm_linux_amd64_v${{ env.SUBWASM_VERSION }}.deb | |
subwasm --version | |
# Display information for wasm | |
- name: Extract metadata | |
run: | | |
subwasm --json info ${{ steps.srtool_build.outputs.wasm }} > ${{ env.CHAIN }}-info.json | |
subwasm info ${{ steps.srtool_build.outputs.wasm }} > ${{ env.CHAIN }}-info.txt | |
cat ${{ env.CHAIN }}-info.txt | |
subwasm --json info ${{ steps.srtool_build.outputs.wasm_compressed }} > ${{ env.CHAIN }}-subwam-info.json | |
subwasm info ${{ steps.srtool_build.outputs.wasm_compressed }} > ${{ env.CHAIN }}-subwam-info.txt | |
cat ${{ env.CHAIN }}-subwam-info.txt | |
# Diff new wasm with current | |
- name: Check the metadata diff | |
run: | | |
subwasm diff wss://${{ env.CHAIN }}-rpc.aca-api.network ${{ steps.srtool_build.outputs.wasm }} | tee ${{ env.CHAIN }}-diff.txt | |
# Generate release notes | |
- name: Generate note | |
id: generate-note | |
uses: AcalaNetwork/acala-release-note-action@master | |
with: | |
chain: ${{ env.CHAIN }} | |
subwasm_info: ${{ env.CHAIN }}-subwam-info.txt | |
srtool_details: ${{ env.CHAIN }}-srtool-digest.json | |
# Create release checklist issue | |
- name: Crate Release Checklist issue | |
uses: JasonEtco/create-an-issue@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
filename: ${{ steps.generate-note.outputs.release-note }} | |
- name: Archive Artifacts for ${{ env.CHAIN }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.CHAIN }}-runtime | |
path: | | |
${{ steps.srtool_build.outputs.wasm }} | |
${{ steps.srtool_build.outputs.wasm_compressed }} | |
${{ env.CHAIN }}-srtool-digest.json | |
${{ env.CHAIN }}-metadata.json | |
${{ env.CHAIN }}-metadata.txt | |
${{ env.CHAIN }}-subwam-info.json | |
${{ env.CHAIN }}-subwam-info.txt | |
${{ env.CHAIN }}-diff.txt | |
- name: Upload wasm to pinata | |
uses: aquiladev/[email protected] | |
with: | |
path: ${{ steps.srtool_build.outputs.wasm_compressed }} | |
service: pinata | |
pinataKey: ${{ secrets.PINATA_KEY }} | |
pinataSecret: ${{ secrets.PINATA_SECRET }} | |