Debian Codegraph @

.github/workflows/release.yml

raw symbols SCIP
1 name: Release
2
3 on:
4 push:
5 tags:
6 - 'v*'
7
8 env:
9 CARGO_TERM_COLOR: always
10
11 permissions:
12 contents: write
13
14 jobs:
15 ci:
16 name: CI
17 uses: ./.github/workflows/ci.yml
18
19 publish:
20 name: Publish to crates.io
21 needs: ci
22 runs-on: ubuntu-latest
23 steps:
24 - uses: actions/checkout@v4
25 - uses: dtolnay/rust-toolchain@stable
26 - uses: Swatinem/rust-cache@v2
27
28 - name: Verify version matches tag
29 run: |
30 TAG="${GITHUB_REF#refs/tags/v}"
31 CARGO_VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
32 if [ "$TAG" != "$CARGO_VERSION" ]; then
33 echo "ERROR: Tag v$TAG does not match Cargo.toml version $CARGO_VERSION"
34 exit 1
35 fi
36 echo "Publishing v$CARGO_VERSION"
37
38 - name: Publish
39 run: cargo publish
40 env:
41 CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
42
43 - name: Create GitHub Release
44 uses: softprops/action-gh-release@v2
45 with:
46 generate_release_notes: true