Skip to content

Publish Release

Publish Release #59

Workflow file for this run

name: Publish Release
# This script is based on Acala's own release script and is used to build and publish the release WASM build of the 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
env:
SUBWASM_VERSION: 0.17.0
on:
workflow_dispatch:
inputs:
# Get name of the chain
chain:
description: Chain Runtime (default = tinkernet)
required: true
default: tinkernet
type: choice
options:
- tinkernet
- invarch
# Get the scope of release note
scope:
description: Release scope (default = full)
required: true
default: full
type: choice
options:
- client
- runtime
- full
tag:
description: 'Release version (e.g. v0.1.0)'
required: true
# 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
jobs:
release:
name: Build and publish ${{ github.event.inputs.chain }}
runs-on: ubuntu-latest
steps:
- name: Checkout Codebase
uses: actions/checkout@v3
with:
submodules: true
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
- name: Install deps
run: sudo apt -y install protobuf-compiler
- name: Install & display rust toolchain
working-directory: ./${{ github.event.inputs.chain }}
run: rustup show
# Build WASM with Substrate Runtime Tool
- name: Srtool build
id: srtool_build
uses: chevdor/[email protected]
env:
BUILD_OPTS: "--features on-chain-release-build"
with:
chain: ${{ github.event.inputs.chain }}
runtime_dir: ./${{ github.event.inputs.chain }}/runtime
tag: ${{ github.event.inputs.srtool_image }}
# Output the build summary
- name: Build Summary
run: |
echo '${{ steps.srtool_build.outputs.json }}' | jq . > ${{ github.event.inputs.chain }}-srtool-digest.json
cat ${{ github.event.inputs.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 }} > ${{ github.event.inputs.chain }}-info.json
subwasm info ${{ steps.srtool_build.outputs.wasm }} > ${{ github.event.inputs.chain }}-info.txt
cat ${{ github.event.inputs.chain }}-info.txt
subwasm --json info ${{ steps.srtool_build.outputs.wasm_compressed }} > ${{ github.event.inputs.chain }}-subwam-info.json
subwasm info ${{ steps.srtool_build.outputs.wasm_compressed }} > ${{ github.event.inputs.chain }}-subwam-info.txt
cat ${{ github.event.inputs.chain }}-subwam-info.txt
- name: Archive Artifacts for ${{ github.event.inputs.chain }}
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.inputs.chain }}-runtime
path: |
${{ steps.srtool_build.outputs.wasm }}
${{ steps.srtool_build.outputs.wasm_compressed }}
${{ github.event.inputs.chain }}-srtool-digest.json
${{ github.event.inputs.chain }}-metadata.json
${{ github.event.inputs.chain }}-metadata.txt
${{ github.event.inputs.chain }}-subwam-info.json
${{ github.event.inputs.chain }}-subwam-info.txt
${{ github.event.inputs.chain }}-diff.txt
- name: Create Tag
uses: negz/create-tag@v1
with:
version: ${{ github.event.inputs.tag }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Generate template data
run: |
TAG=${{ github.event.inputs.tag }}
NETWORK=${{ github.event.inputs.chain }}
SRTOOL_DETAILS=$(cat ${{ github.event.inputs.chain }}-srtool-digest.json)
SUBWASM_DETAILS=$(cat ${{ github.event.inputs.chain }}-subwam-info.json)
echo 'Template data:'
jq -n \
--arg tag "$TAG" \
--arg network "$NETWORK" \
--arg srtool_details "$SRTOOL_DETAILS" \
--arg subwasm_details "$SUBWASM_DETAILS" \
'{
tag: $tag,
network: $network,
srtool_details: $srtool_details,
subwasm_details: $subwasm_details
}' | tee template_data.json
- name: Render release page
uses: jayamanikharyono/[email protected]
with:
datafile: template_data.json
path: .github/release-template.md
- name: Publish github release
uses: softprops/action-gh-release@v1
with:
files: |
${{ steps.srtool_build.outputs.wasm }}
${{ steps.srtool_build.outputs.wasm_compressed }}
body_path: ".github/release-template.md"
tag_name: ${{ github.event.inputs.tag }}
token: ${{ secrets.GITHUB_TOKEN }}