Publish Release #24
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 action is based on InvArch's release action: https://github.com/InvArch/InvArch-Node/blob/main/.github/workflows/release.yml | |
env: | |
SUBWASM_VERSION: 0.18.0 | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Release version (e.g. v0.1.0)' | |
required: true | |
codename: | |
description: 'codename 🐶' | |
required: true | |
srtool_image: | |
description: Default to use the latest. You can use an alternate image, use with caution! | |
required: false | |
jobs: | |
build_binary: | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
# - macos-latest | |
# - windows-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly-2022-05-01 | |
target: wasm32-unknown-unknown | |
- name: Build binary | |
run: cargo build --release | |
- name: Upload binary | |
uses: actions/upload-artifact@v2 | |
with: | |
name: gm-binary-${{ matrix.os }} | |
path: target/release/gm-chain-node | |
release: | |
name: Build and publish GM Runtime | |
needs: build_binary | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the codebase | |
- name: Checkout Codebase | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
# Build WASM with Substrate Runtime Tool | |
- name: Srtool build | |
id: srtool_build | |
uses: chevdor/srtool-actions@v0.4.0 | |
env: | |
BUILD_OPTS: "" | |
with: | |
chain: gm-chain | |
runtime_dir: runtime | |
tag: ${{ github.event.inputs.srtool_image }} | |
# Output the build summary | |
- name: Build Summary | |
run: | | |
echo '${{ steps.srtool_build.outputs.json }}' | jq . > gm-srtool-digest.json | |
cat gm-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 }} > gm-info.json | |
subwasm info ${{ steps.srtool_build.outputs.wasm }} > gm-info.txt | |
cat gm-info.txt | |
subwasm --json info ${{ steps.srtool_build.outputs.wasm_compressed }} > gm-subwam-info.json | |
subwasm info ${{ steps.srtool_build.outputs.wasm_compressed }} > gm-subwam-info.txt | |
cat gm-subwam-info.txt | |
- name: Archive Artifacts for GM | |
uses: actions/upload-artifact@v2 | |
with: | |
name: gm-runtime | |
path: | | |
${{ steps.srtool_build.outputs.wasm }} | |
${{ steps.srtool_build.outputs.wasm_compressed }} | |
gm-srtool-digest.json | |
gm-metadata.json | |
gm-metadata.txt | |
gm-subwam-info.json | |
gm-subwam-info.txt | |
gm-diff.txt | |
- name: Create Tag | |
uses: laputansoft/github-tag-action@v4.6 | |
with: | |
tag: ${{ github.event.inputs.tag }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Generate template data | |
run: | | |
TAG=${{ github.event.inputs.tag }} | |
CODENAME="${{ github.event.inputs.codename }}" | |
SRTOOL_DETAILS=$(cat gm-srtool-digest.json) | |
SUBWASM_DETAILS=$(cat gm-subwam-info.json) | |
echo 'Template data:' | |
jq -n \ | |
--arg tag "$TAG" \ | |
--arg codename "$CODENAME" \ | |
--arg srtool_details "$SRTOOL_DETAILS" \ | |
--arg subwasm_details "$SUBWASM_DETAILS" \ | |
'{ | |
tag: $tag, | |
codename: $codename, | |
srtool_details: $srtool_details, | |
subwasm_details: $subwasm_details | |
}' | tee template_data.json | |
- name: Render release page | |
uses: jayamanikharyono/jinja-action@v0.1 | |
with: | |
datafile: template_data.json | |
path: .github/release-template.md | |
- name: Download linux binary | |
uses: actions/download-artifact@v3 | |
with: | |
name: gm-binary-ubuntu-latest | |
# - name: Download mac binary | |
# uses: actions/download-artifact@v3 | |
# with: | |
# name: gm-binary-macos-latest | |
# - name: Download windows binary | |
# uses: actions/download-artifact@v3 | |
# with: | |
# name: gm-binary-windows-latest | |
- name: Publish github release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
gm-chain-node | |
${{ steps.srtool_build.outputs.wasm }} | |
${{ steps.srtool_build.outputs.wasm_compressed }} | |
body_path: ".github/release-template.md" | |
tag_name: ${{ github.event.inputs.tag }} | |
name: "${{ github.event.inputs.tag }} - ${{ github.event.inputs.codename }}" | |
token: ${{ secrets.GITHUB_TOKEN }} |