1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Release
on:
push:
tags:
permissions:
contents: write
jobs:
ci:
name: CI Gate
uses: ./.github/workflows/ci.yml
publish:
name: Publish to crates.io
runs-on: ubuntu-latest
needs:
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Verify version consistency
run: |
FILE_VERSION=$(cat VERSION | tr -d '[:space:]')
CARGO_VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
TAG_VERSION="${GITHUB_REF_NAME}"
if [ "$FILE_VERSION" != "$TAG_VERSION" ]; then
echo "ERROR: VERSION ($FILE_VERSION) != tag ($TAG_VERSION)"
exit 1
fi
if [ "$CARGO_VERSION" != "$TAG_VERSION" ]; then
echo "ERROR: Cargo.toml ($CARGO_VERSION) != tag ($TAG_VERSION)"
exit 1
fi
echo "Version verified: $TAG_VERSION"
- name: Publish
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs:
steps:
- uses: actions/checkout@v4
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true