Trigger Release #6
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
# This action is triggered by a manual workflow_dispatch event. | |
# It takes input of release version number like "2.3.4". | |
# This action executes `cargo-release` and `wasm-pack publish` and pushes the changes to the repository. | |
name: Trigger Release | |
on: | |
workflow_dispatch: | |
inputs: | |
release_version: | |
description: "Release version number (You must write CHANGELOG.md before running this action. Also this action must be done only in main branch.)" | |
required: true | |
type: string | |
skip-cargo-release: | |
description: "Skip cargo-release" | |
required: false | |
type: boolean | |
skip-wasm-pack-publish: | |
description: "Skip wasm-pack publish" | |
required: false | |
type: boolean | |
jobs: | |
release: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Install system requirements for Linux | |
run: | | |
sudo apt update -y | |
sudo apt install -y libasound2-dev | |
- name: Setup .npmrc file to publish to npm | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Cache cargo registry | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Add git config | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Actions[Bot]" | |
- name: Run cargo release | |
if: ${{ !inputs.skip-cargo-release }} | |
run: | | |
cargo install cargo-release | |
cargo release ${{ inputs.release_version }} --execute --no-confirm | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATEIO_TOKEN }} | |
- name: Run wasm-pack publish | |
if: ${{ !inputs.skip-wasm-pack-publish }} | |
run: | | |
cargo install wasm-pack | |
wasm-pack build --target web | |
wasm-pack publish --target web | |
working-directory: mimium-web | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} |