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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Release
on:
push:
tags:
env:
CARGO_TERM_COLOR: always
jobs:
ci:
name: CI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.96"
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@nextest
- run: cargo fmt --check
- run: cargo clippy --all-targets --all-features -- -D warnings
- run: cargo nextest run --all-features
- run: cargo test --doc --all-features
- run: cargo build --release --all-features
- run: cargo doc --all-features --no-deps
env:
RUSTDOCFLAGS: "-D warnings"
- run: cargo generate-lockfile
- uses: taiki-e/install-action@cargo-audit
- run: cargo audit
publish:
name: Publish to crates.io
needs: ci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.96"
- name: Verify tag matches Cargo.toml version
run: |
CARGO_VERSION="v$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/')"
TAG_VERSION="${GITHUB_REF#refs/tags/}"
if [ "$CARGO_VERSION" != "$TAG_VERSION" ]; then
echo "ERROR: Tag ($TAG_VERSION) does not match Cargo.toml version ($CARGO_VERSION)"
exit 1
fi
echo "Version match: $TAG_VERSION"
- run: cargo publish --all-features
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
github-release:
name: GitHub Release
needs:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v5
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true