Skip to content

Commit a635660

Browse files
committed
ci: use trusted publishing
1 parent d008963 commit a635660

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

.github/workflows/release.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ defaults:
2020
jobs:
2121
release:
2222
runs-on: ubuntu-latest
23-
# The permissions should allow the user to:
24-
# 1. Push to the branch of the repository that triggered the workflow.
25-
# 2. Create a tag.
26-
# 3. Push to crates.io.
2723
permissions:
24+
# The contents write should allow:
25+
# 1. Push to the branch of the repository that triggered the workflow.
26+
# 2. Create a tag.
27+
# 3. Push to crates.io.
2828
contents: write
29+
# The id-token write should allow the OIDC token exchange
30+
id-token: write
2931
steps:
3032
- uses: actions/checkout@v4
3133
- name: Install required packages
@@ -34,9 +36,11 @@ jobs:
3436
run: cargo install --version 0.25.17 cargo-release
3537
- name: Set git user
3638
run: |
37-
git config --global user.email "${GITHUB_TRIGGERING_ACTOR}@users.noreply.github.com>"
39+
git config --global user.email "${GITHUB_TRIGGERING_ACTOR}@users.noreply.github.com"
3840
git config --global user.name "${GITHUB_TRIGGERING_ACTOR}"
41+
- uses: rust-lang/crates-io-auth-action@v1
42+
id: auth
3943
- name: Run cargo release
4044
env:
41-
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
45+
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
4246
run: cargo release ${{ github.event.inputs.level }} --no-confirm --execute

0 commit comments

Comments
 (0)