chore: prepare to publish v0.3.0 #6
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: Publish | |
on: | |
push: | |
tags: | |
- "v*.*.*" | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Version of the release, should match an existing tag name. E.g. v0.1.0" | |
required: true | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# set the version to the input. if the input is not set (triggered by tag), it will be the tag name | |
- run: echo "VERSION=${{ inputs.version || github.ref_name }}" >> $GITHUB_ENV | |
# validate crate version | |
- run: | | |
VERSION=`cargo metadata --format-version=1 --no-deps | jq '.packages[0].version' | tr -d '"'` | |
[ "v$VERSION" = "${{ env.VERSION }}" ] || (echo "Version mismatch" && exit 1) | |
# validate CHANGELOG version | |
# TODO: use a CHANGELOG linter | |
- run: | | |
VERSION=`cargo metadata --format-version=1 --no-deps | jq '.packages[0].version' | tr -d '"'` | |
grep -q "## \[$VERSION\]" CHANGELOG.md || (echo "Version not found in CHANGELOG" && exit 1) | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
- run: cargo fmt --check | |
- run: cargo clippy -- -D warnings | |
- run: cargo test | |
- run: cargo test --examples | |
- run: cargo doc | |
env: | |
RUSTDOCFLAGS: -D warnings | |
- run: gh workflow run coverage.yml | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- run: cargo publish | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
# create the release | |
- run: gh release create ${{ env.VERSION }} -t ${{ env.VERSION }} --verify-tag -n "See [CHANGELOG.md](https://github.com/DiscreteTom/whitehole/blob/main/CHANGELOG.md)." | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |