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
name: ci
on:
push:
pull_request:
workflow_dispatch:
jobs:
check:
strategy:
matrix:
os:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master
with:
toolchain: "1.99.0"
components: rustfmt, clippy
- run: cargo fmt --all --check
- run: cargo clippy --workspace --all-targets --locked -- -D warnings
- run: cargo test --workspace --locked
- run: cargo doc --workspace --no-deps --locked
env:
RUSTDOCFLAGS: "-D warnings"
release:
# a commit on main that raises a version releases it once every check passed (CONTRIBUTING.md, Releasing)
needs:
if: github.event_name != 'pull_request' && github.ref_name == github.event.repository.default_branch
runs-on: ubuntu-latest
concurrency: release
permissions:
contents: write # tags and GitHub Releases
id-token: write # crates.io trusted publishing
actions: write # start release.yml, which builds the binaries
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master
with:
toolchain: "1.99.0"
- uses: release-plz/action@66b324fd6c72d05d2a08568492ecdd62bfb8a62b # v0.5.148
with:
command: release
env:
GITHUB_TOKEN: ${{ github.token }}
# a tag pushed with this job's token starts no workflow, so this starts the binaries' (release.yml) for each
# Release of this commit that is still a draft (also when a rerun finishes a release)
- if: hashFiles('.github/workflows/release.yml') != ''
env:
GH_TOKEN: ${{ github.token }}
run: |
git fetch -q --tags
drafts=$(gh release list --limit 100 --json tagName,isDraft --jq '.[] | select(.isDraft) | .tagName')
for tag in $(git tag --points-at HEAD); do
if grep -qx "$tag" <<< "$drafts"; then
gh workflow run release.yml --ref "$tag" -f tag="$tag"
fi
done