Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Release with CI via git tag #289

Merged
merged 2 commits into from
Nov 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
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
Loading