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
name: Release
on:
release:
types:
env:
CARGO_TERM_COLOR: always
concurrency:
group: release-${{ github.event.release.tag_name }}
cancel-in-progress: true
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Verify release tag matches Cargo.toml version
run: |
set -euo pipefail
TAG="${{ github.event.release.tag_name }}"
TAG_VER="${TAG#v}"
CRATE_VER=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name=="suitecase") | .version')
echo "Release tag: ${TAG} (expected version: ${TAG_VER})"
echo "Cargo.toml version: ${CRATE_VER}"
if [ "${TAG_VER}" != "${CRATE_VER}" ]; then
echo "::error::Tag version '${TAG_VER}' does not match crate version '${CRATE_VER}'. Bump version in Cargo.toml before tagging."
exit 1
fi
- name: Build
run: cargo build --all-targets --verbose
- name: Test
run: cargo test --all-targets --verbose
- name: Publish to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish --locked