-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f091a9e
commit cfe5cf1
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
release: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Assert release version matches crate version | ||
run: | | ||
set -euo pipefail | ||
# Get release version from Git tag | ||
tag_version=${GITHUB_REF#refs/tags/v} | ||
# Get crate version from Cargo.toml | ||
crate_version=$(cargo read-manifest | jq -r .version) | ||
if [ "$tag_version" != "$crate_version" ]; then | ||
echo "Error: Release version ${tag_version} from Git tag does not match crate version ${crate_version} from Cargo.toml" | ||
exit 1 | ||
fi | ||
- name: Publish crate to crates.io | ||
env: | ||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||
run: cargo publish --dry-run |