Skip to content

Commit c52a2fa

Browse files
authored
👷 GitHub Actions CI workflow to publish to crates.io (#49)
Based on https://crates.io/docs/trusted-publishing, though the trusted publishing doesn't work yet as this is the first release.
1 parent c142ede commit c52a2fa

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

.github/workflows/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Publish to crates.io
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions: {}
8+
9+
jobs:
10+
publish-to-crates-io:
11+
name: Publish Rust 🦀 package 📦 to crates.io
12+
runs-on: ubuntu-24.04
13+
environment: cratesio # Optional: for enhanced security
14+
permissions:
15+
id-token: write # Required for OIDC token exchange
16+
contents: read # Required to checkout repository
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
21+
with:
22+
fetch-depth: 0
23+
persist-credentials: false
24+
25+
# - name: Authenticate with registry
26+
# uses: rust-lang/crates-io-auth-action@v1
27+
# id: auth
28+
29+
- name: Publish package 📦 to crates.io
30+
run: cargo publish
31+
env:
32+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} # ${{ steps.auth.outputs.token }}

0 commit comments

Comments
 (0)