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
name: Release
# Push a `vX.Y.Z` tag on main: CI runs for that commit, then the crate is
# published to crates.io (Trusted Publishing, no stored token) and a GitHub
# release is created from the CHANGELOG section. See RELEASING.md.
on:
push:
tags:
permissions:
contents: read
jobs:
ci:
uses: ./.github/workflows/ci.yml
publish:
needs: ci
runs-on: ubuntu-latest
timeout-minutes: 20
environment: crates-io
permissions:
contents: write # the GitHub release
id-token: write # crates.io Trusted Publishing
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Tag, Cargo.toml and CHANGELOG agree
run: |
version="${GITHUB_REF_NAME#v}"
manifest=$(grep -m1 '^version' Cargo.toml | cut -d'"' -f2)
[ "$version" = "$manifest" ] || { echo "tag $GITHUB_REF_NAME != Cargo.toml $manifest"; exit 1; }
awk -v v="$version" '
index($0, "## [" v "]") == 1 { on = 1; next }
on && /^## \[/ { exit }
on { print }
' CHANGELOG.md > "$RUNNER_TEMP/notes.md"
[ -s "$RUNNER_TEMP/notes.md" ] || { echo "CHANGELOG.md has no ## [$version] section"; exit 1; }
- run: rustup toolchain install stable --profile minimal --no-self-update && rustup default stable
- name: The packaged crate builds with every feature
run: bash scripts/package-check.sh
- uses: rust-lang/crates-io-auth-action@c6f97d42243bad5fab37ca0427f495c86d5b1a18 # v1.0.5
id: auth
- run: cargo publish --locked -p asx
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
- run: gh release create "$GITHUB_REF_NAME" --verify-tag --title "asx $GITHUB_REF_NAME" --notes-file "$RUNNER_TEMP/notes.md"
env:
GH_TOKEN: ${{ github.token }}