Initialization #7
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: Release | |
on: | |
push: | |
tags: | |
- "v*" | |
permissions: | |
# Necessary to trigger the override workflow. | |
actions: write | |
# Necessary to publish the release. | |
contents: write | |
env: | |
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse | |
CARGO_TERM_COLOR: always | |
RUST_BACKTRACE: full | |
jobs: | |
# This job triggers the override workflow for the target runtime. | |
trigger-override: | |
name: Trigger override | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# Add the runtime here that you want to build its override. | |
# | |
# The possible values are defined in the `override.yml` workflow. | |
runtime: ["polkadot-runtime", "staging-kusama-runtime"] | |
steps: | |
- name: Trigger override | |
env: | |
# Use a Personal Access Token (PAT) if `GITHUB_TOKEN` does not have enough permissions to trigger the override workflow. | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: gh workflow run override.yml | |
--repo hack-ink/polkadot-runtime-releaser-workshop | |
--ref main | |
-f runtime="${{ matrix.runtime }}" | |
-f ref="${{ github.ref_name }}" | |
build-runtime: | |
name: Build runtime | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# Add the runtime here that you want to release. | |
runtime: ["polkadot-runtime", "staging-kusama-runtime"] | |
steps: | |
- name: Fetch latest code | |
uses: actions/checkout@v4 | |
- name: Build runtime | |
# It is recommended to use a specific version of the action in production. | |
# | |
# For example: | |
# uses: hack-ink/polkadot-runtime-releaser/action/override@v0.2.0 | |
uses: hack-ink/polkadot-runtime-releaser/action/build@main | |
with: | |
runtime: ${{ matrix.runtime }} | |
# The features to enable for this release build. | |
# | |
# Generally, this would be `on-chain-release-build` in order to disable the logging to shrink the WASM binary size. | |
features: on-chain-release-build | |
# The output directory of the WASM binary. | |
output-dir: . | |
- name: Locate runtime | |
id: locate | |
run: | | |
RUNTIME=$(find . -maxdepth 1 -name '*.wasm' | head -n 1) | |
echo "runtime=$RUNTIME" >> "$GITHUB_OUTPUT" | |
- name: Inspect runtime | |
uses: hack-ink/polkadot-runtime-releaser/action/inspect@main | |
with: | |
runtime: ${{ steps.locate.outputs.runtime }} | |
- name: Construct build info | |
run: | | |
echo "${{ steps.inspect.outputs.result }}" | jq '.' > result_pretty.json | |
jq --arg runtime "${{ matrix.runtime }}" | |
--argfile res result_pretty.json | |
'.runtime = $runtime | .result = $res' | |
<<< '{}' > runtime.json | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.runtime }}-artifact | |
path: | | |
${{ steps.locate.outputs.runtime }} | |
runtime.json | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: build-runtime | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
path: download | |
- name: Construct release notes | |
run: | | |
echo "# Release for tag \`${{ github.ref }}\`" > release_note.md | |
echo "" >> release_note.md | |
for artifact_dir in download/*-artifact; do | |
if [ -f "$artifact_dir/runtime.json" ]; then | |
RUNTIME=$(jq -r '.runtime' "$artifact_dir/runtime.json") | |
RESULT=$(jq '.result' "$artifact_dir/runtime.json") | |
echo "## $RUNTIME" >> release_note.md | |
echo "\`\`\`json" >> release_note.md | |
echo "$RESULT" | jq '.' >> release_note.md | |
echo "\`\`\`" >> release_note.md | |
echo "" >> release_note.md | |
fi | |
done | |
- name: Publish release | |
uses: softprops/action-gh-release@v2 | |
with: | |
body_path: release_note.md | |
files: | | |
download/**/*.wasm |