Skip to content

Commit

Permalink
ci: Release with CI via git tag
Browse files Browse the repository at this point in the history
  • Loading branch information
jakoschiko authored and duesee committed Nov 18, 2024
1 parent f091a9e commit cfe5cf1
Showing 1 changed file with 34 additions and 0 deletions.
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 --dry-run

0 comments on commit cfe5cf1

Please sign in to comment.