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
name: Publish to crates.io
# Publishes via crates.io Trusted Publishing (OIDC) — no API token secret.
# Configure the matching publisher at:
# crates.io > cobs_codec_rs > Settings > Trusted Publishing
# owner=firechip repo=cobs_codec_rs workflow=release.yml environment=release
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: read
jobs:
publish:
name: Publish to crates.io (Trusted Publishing)
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write # required for the OIDC token exchange
contents: read
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- name: Verify before publishing
run: |
cargo fmt --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test --all-features
- name: Authenticate to crates.io (OIDC)
uses: rust-lang/crates-io-auth-action@v1
id: auth
- name: Publish
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}