Initialization #9
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"] | ||
env: | ||
RUNTIME: ${{ matrix.runtime//-/_ }} | ||
Check failure on line 49 in .github/workflows/release.yml GitHub Actions / ReleaseInvalid workflow file
|
||
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: Construct runtime info | ||
run: | | ||
WASM=$(ls "${{ env.RUNTIME }}"-*.compact.compressed.wasm) | ||
JSON=$(ls "${{ env.RUNTIME }}"-*.json) | ||
cat "$JSON" | jq '.' > tmp.json | ||
mv tmp.json "$JSON" | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.runtime }}-artifact | ||
path: | | ||
${{ env.RUNTIME }}-*.compact.compressed.wasm | ||
${{ env.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 [ -d "$artifact_dir" ]; then | ||
for json_file in "$artifact_dir"/*.json; do | ||
[ -f "$json_file" ] || continue | ||
BASE_NAME="$(basename "$json_file")" | ||
NAME_NO_EXT="${BASE_NAME%.json}" | ||
NAME="${NAME_NO_EXT//_/-}" | ||
echo "## $NAME" >> release_note.md | ||
echo "\`\`\`json" >> release_note.md | ||
cat "$json_file" >> release_note.md | ||
echo "\`\`\`" >> release_note.md | ||
echo "" >> release_note.md | ||
done | ||
fi | ||
done | ||
- name: Publish release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
body_path: release_note.md | ||
files: | | ||
download/**/*.wasm |