Skip to content

Commit 6b1b598

Browse files
authored
Use crates.io trusted publish (#303)
* Use crates.io trusted publish Signed-off-by: James Sturtevant <jsturtevant@gmail.com> * Don't need token for dry run Signed-off-by: James Sturtevant <jsturtevant@gmail.com> --------- Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
1 parent d49a6ef commit 6b1b598

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

.github/workflows/CreateRelease.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
permissions:
99
contents: write
1010
packages: write
11+
id-token: write # Required for crates.io trusted publishing
1112

1213
jobs:
1314

@@ -104,14 +105,16 @@ jobs:
104105
env:
105106
GH_TOKEN: ${{ github.token }}
106107
shell: bash
108+
- name: Authenticate with crates.io
109+
if: ${{ contains(github.ref, 'refs/heads/release/') }}
110+
uses: rust-lang/crates-io-auth-action@v1
111+
id: crates-io-auth
107112
- name: Publish dry-run
108113
if: ${{ contains(github.ref, 'refs/heads/release/') }}
109114
run: |
110115
set -euxo pipefail
111116
cargo publish -p hyperlight-wasm-aot --dry-run
112117
cargo publish -p hyperlight-wasm --dry-run
113-
env:
114-
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_PUBLISH_TOKEN }}
115118
shell: bash
116119
- name: Publish to crates.io
117120
if: ${{ contains(github.ref, 'refs/heads/release/') }}
@@ -120,5 +123,5 @@ jobs:
120123
cargo publish -p hyperlight-wasm-aot
121124
cargo publish -p hyperlight-wasm
122125
env:
123-
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_PUBLISH_TOKEN }}
126+
CARGO_REGISTRY_TOKEN: ${{ steps.crates-io-auth.outputs.token }}
124127
shell: bash

0 commit comments

Comments
 (0)