Skip to content

Release

Release #185

Workflow file for this run

name: Release
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
inputs:
patch:
type: number
description: "Release patch version number (default 0)"
default: 0
required: true
env:
CARGO_TERM_COLOR: always
jobs:
release-to-github:
runs-on: [seed-builder]
steps:
- name: Check out
uses: actions/checkout@v3
with:
ref: ${{ github.ref_name }}
fetch-depth: 0
- name: Find release version
id: find_client_version
# client version is `x.y.z` in `client/Cargo.toml`; only get `z` part
run: |
echo ::set-output name=client_version::$(grep '^version' client/Cargo.toml | sed 's/.*"\([0-9]*\)\.\([0-9]*\)\..*/\1/')
- name: Find spec version
id: find_spec_version
run: |
echo ::set-output name=spec_version::$(grep 'spec_version:.*,$' runtime/src/lib.rs | sed 's/[^0-9]*//g')
- name: Generate release tag name 🏷️
id: generate_tag_name # v<client-version>.<spec-version>.<patch>
run: |
echo ::set-output name=tag_name::v${{ steps.find_client_version.outputs.client_version }}.${{ steps.find_spec_version.outputs.spec_version }}.${{ github.event.inputs.patch }}
- name: Generate changelog 📜
# generate changelog from commits since previous latest tag
run: git log $(git tag --sort=committerdate | tail -1)..HEAD > CHANGELOG.md
- name: Tag the release 🚀
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.generate_tag_name.outputs.tag_name }}
release_name: ${{ steps.generate_tag_name.outputs.tag_name }}
# 'rc' is a pre-release
# prerelease: ${{ contains(steps.generate_tag_name.outputs.tag_name, 'rc') }}
body_path: CHANGELOG.md
### build the wasm runtime for publishing
- name: Install toolchain
run: rustup show
- name: Build wasm (again)
run: cargo build
- name: Publish runtime wasm
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./target/debug/wbuild/seed-runtime/seed_runtime.compact.compressed.wasm
asset_name: seed_runtime-${{ steps.find_spec_version.outputs.spec_version }}.compact.compressed.wasm
asset_content_type: application/wasm
# TODO: Slack notification on release
# on-success:
# needs: release-to-github
# if: ${{ success() }}
# runs-on: ubuntu-latest
# steps:
# - uses: rtCamp/action-slack-notify@v2
# env:
# SLACK_MESSAGE: "Release success :rocket:"
# SLACK_USERNAME: "Seed status"
# SLACK_ICON_EMOJI: ":white_check_mark:"
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}