Skip to content

Commit 5867bc7

Browse files
oschwaldclaude
andcommitted
Add Trusted Publishing workflow for crates.io
Uses OIDC token exchange via rust-lang/crates-io-auth-action to publish to crates.io without long-lived API tokens. Triggers on version tags (v*) and requires the "release" environment. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent da0ecf6 commit 5867bc7

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

.github/workflows/release.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Publish to crates.io
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
publish:
10+
name: Publish
11+
runs-on: ubuntu-latest
12+
environment: release
13+
permissions:
14+
id-token: write
15+
contents: read
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Install Rust toolchain
21+
uses: dtolnay/rust-toolchain@stable
22+
23+
- name: Authenticate with crates.io
24+
uses: rust-lang/crates-io-auth-action@v1
25+
id: auth
26+
27+
- name: Publish to crates.io
28+
run: cargo publish
29+
env:
30+
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}

0 commit comments

Comments
 (0)