Skip to content

Commit 0e61f70

Browse files
authored
Merge pull request #306 from glotzerlab/trusted-publishing
Switch to the trusted publishing workflow.
2 parents 4cc504a + ae26999 commit 0e61f70

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

.github/workflows/release.yaml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
branches:
1515
- trunk
1616
tags:
17-
- "*"
17+
- "[0-9]+.[0-9]+.[0-9]+"
1818

1919
workflow_dispatch:
2020

@@ -158,7 +158,11 @@ jobs:
158158

159159
publish_cargo:
160160
name: Publish [Cargo]
161+
if: startsWith(github.ref, 'refs/tags/')
161162
runs-on: ubuntu-24.04
163+
environment: release
164+
permissions:
165+
id-token: write
162166
steps:
163167
- name: Checkout
164168
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -167,8 +171,10 @@ jobs:
167171
uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9
168172
with:
169173
toolchain: 1.94.0
170-
- name: Dry run
171-
run: cargo publish --all-features --dry-run
174+
- name: Authorize with crates.io
175+
uses: rust-lang/crates-io-auth-action@b7e9a28eded4986ec6b1fa40eeee8f8f165559ec # v1.0.3
176+
id: auth
172177
- name: Publish to crates.io
173-
if: startsWith(github.ref, 'refs/tags/')
174-
run: cargo publish --all-features --token ${{ secrets.CRATES_IO_API_TOKEN }}
178+
run: cargo publish --all-features
179+
env:
180+
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}

0 commit comments

Comments
 (0)