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
39
40
name: publish
on:
workflow_dispatch:
inputs:
confirm:
description: "Type 'publish' to publish to crates.io"
required: true
default: "dry-run"
permissions:
contents: read
id-token: write
env:
CARGO_TERM_COLOR: always
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Guard
run: |
if [ "${{ inputs.confirm }}" != "publish" ]; then
echo "Refusing to publish: set workflow input confirm=publish"
exit 1
fi
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Authenticate (Trusted Publishing)
id: auth
uses: rust-lang/crates-io-auth-action@v1
- name: cargo publish (jin)
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
run: cargo publish