Skip to content

Commit 49b1beb

Browse files
committed
ci: switch crates.io publishing to Trusted Publishing (OIDC)
Replaces token-based publish-crate.yml with OIDC release.yml (env release).
1 parent 2ab9b24 commit 49b1beb

2 files changed

Lines changed: 38 additions & 31 deletions

File tree

.github/workflows/publish-crate.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish to crates.io
2+
3+
# Publishes via crates.io Trusted Publishing (OIDC) — no API token secret.
4+
# Configure the matching publisher at:
5+
# crates.io > cobs_codec_rs > Settings > Trusted Publishing
6+
# owner=firechip repo=cobs_codec_rs workflow=release.yml environment=release
7+
on:
8+
push:
9+
tags:
10+
- "v*"
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
publish:
18+
name: Publish to crates.io (Trusted Publishing)
19+
runs-on: ubuntu-latest
20+
environment: release
21+
permissions:
22+
id-token: write # required for the OIDC token exchange
23+
contents: read
24+
steps:
25+
- uses: actions/checkout@v6
26+
- uses: dtolnay/rust-toolchain@stable
27+
- name: Verify before publishing
28+
run: |
29+
cargo fmt --check
30+
cargo clippy --all-targets --all-features -- -D warnings
31+
cargo test --all-features
32+
- name: Authenticate to crates.io (OIDC)
33+
uses: rust-lang/crates-io-auth-action@v1
34+
id: auth
35+
- name: Publish
36+
run: cargo publish
37+
env:
38+
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}

0 commit comments

Comments
 (0)