File tree Expand file tree Collapse file tree 1 file changed +62
-0
lines changed
Expand file tree Collapse file tree 1 file changed +62
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Release
2+
3+ on :
4+ release :
5+ types : [published]
6+ workflow_dispatch :
7+ inputs :
8+ tag :
9+ description : " Tag to release (e.g. v0.0.3)"
10+ required : true
11+ dry-run :
12+ description : " Dry run (skip crates.io publish)"
13+ required : false
14+ default : false
15+ type : boolean
16+
17+ jobs :
18+ publish :
19+ name : Build and publish to crates.io
20+ runs-on : ubuntu-latest
21+ environment : crates-io
22+
23+ permissions :
24+ contents : read
25+ id-token : write # Required for OIDC trusted publishing.
26+
27+ steps :
28+ - name : Checkout code
29+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
30+ with :
31+ fetch-depth : 0
32+
33+ - name : Checkout release tag
34+ run : |
35+ git fetch --tags
36+ TAG="${{ github.event.release.tag_name || github.event.inputs.tag }}"
37+ if [ -z "$TAG" ]; then
38+ echo "Error: No tag provided in release event or workflow_dispatch input"
39+ exit 1
40+ fi
41+ echo "Checking out tag $TAG"
42+ git checkout "$TAG"
43+
44+ - name : Setup Rust toolchain
45+ uses : dtolnay/rust-toolchain@stable
46+
47+ - name : Install protoc
48+ run : sudo apt-get update && sudo apt-get install -y protobuf-compiler
49+
50+ - name : Build
51+ run : cargo build --release
52+
53+ - name : Authenticate with crates.io
54+ if : ${{ !inputs.dry-run }}
55+ uses : rust-lang/crates-io-auth-action@v1
56+ id : auth
57+
58+ - name : Publish to crates.io
59+ if : ${{ !inputs.dry-run }}
60+ run : cargo publish
61+ env :
62+ CARGO_REGISTRY_TOKEN : ${{ steps.auth.outputs.token }}
You can’t perform that action at this time.
0 commit comments