Skip to content

Commit 637abc6

Browse files
authored
Use crates.io trusted publishing (#1109)
Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
1 parent 9e81654 commit 637abc6

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

.github/workflows/CargoPublish.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ on:
1818

1919
permissions:
2020
contents: read
21+
id-token: write
2122

2223
jobs:
2324
publish-hyperlight-packages:
@@ -34,6 +35,7 @@ jobs:
3435
- uses: hyperlight-dev/ci-setup-workflow@v1.8.0
3536
with:
3637
rust-toolchain: "1.89"
38+
3739
- name: Check crate versions
3840
shell: bash
3941
run: |
@@ -76,60 +78,64 @@ jobs:
7678
needs_publish hyperlight-host
7779
needs_publish hyperlight-guest-tracing
7880
81+
- name: Authenticate with crates.io
82+
uses: rust-lang/crates-io-auth-action@v1
83+
id: crates-io-auth
84+
7985
- name: Publish hyperlight-common
8086
continue-on-error: ${{ inputs.dry_run }}
8187
run: cargo publish --manifest-path ./src/hyperlight_common/Cargo.toml ${{ inputs.dry_run && '--dry-run' || '' }}
8288
env:
83-
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_PUBLISH_TOKEN }}
89+
CARGO_REGISTRY_TOKEN: ${{ steps.crates-io-auth.outputs.token }}
8490
if: env.PUBLISH_HYPERLIGHT_COMMON != 'false'
8591

8692
- name: Publish hyperlight-guest-tracing
8793
continue-on-error: ${{ inputs.dry_run }}
8894
run: cargo publish --manifest-path ./src/hyperlight_guest_tracing/Cargo.toml ${{ inputs.dry_run && '--dry-run' || '' }}
8995
env:
90-
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_PUBLISH_TOKEN }}
96+
CARGO_REGISTRY_TOKEN: ${{ steps.crates-io-auth.outputs.token }}
9197
if: env.PUBLISH_HYPERLIGHT_GUEST_TRACING != 'false'
9298

9399
- name: Publish hyperlight-guest
94100
continue-on-error: ${{ inputs.dry_run }}
95101
run: cargo publish --manifest-path ./src/hyperlight_guest/Cargo.toml ${{ inputs.dry_run && '--dry-run' || '' }}
96102
env:
97-
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_PUBLISH_TOKEN }}
103+
CARGO_REGISTRY_TOKEN: ${{ steps.crates-io-auth.outputs.token }}
98104
if: env.PUBLISH_HYPERLIGHT_GUEST != 'false'
99105

100106
- name: Publish hyperlight-guest-macro
101107
continue-on-error: ${{ inputs.dry_run }}
102108
run: cargo publish --manifest-path ./src/hyperlight_guest_macro/Cargo.toml ${{ inputs.dry_run && '--dry-run' || '' }}
103109
env:
104-
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_PUBLISH_TOKEN }}
110+
CARGO_REGISTRY_TOKEN: ${{ steps.crates-io-auth.outputs.token }}
105111
if: env.PUBLISH_HYPERLIGHT_GUEST_MACRO != 'false'
106112

107113
- name: Publish hyperlight-guest-bin
108114
continue-on-error: ${{ inputs.dry_run }}
109115
run: cargo publish --manifest-path ./src/hyperlight_guest_bin/Cargo.toml ${{ inputs.dry_run && '--dry-run' || '' }}
110116
env:
111-
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_PUBLISH_TOKEN }}
117+
CARGO_REGISTRY_TOKEN: ${{ steps.crates-io-auth.outputs.token }}
112118
if: env.PUBLISH_HYPERLIGHT_GUEST_BIN != 'false'
113119

114120
- name: Publish hyperlight-component-util
115121
continue-on-error: ${{ inputs.dry_run }}
116122
run: cargo publish --manifest-path ./src/hyperlight_component_util/Cargo.toml ${{ inputs.dry_run && '--dry-run' || '' }}
117123
env:
118-
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_PUBLISH_TOKEN }}
124+
CARGO_REGISTRY_TOKEN: ${{ steps.crates-io-auth.outputs.token }}
119125
if: env.PUBLISH_HYPERLIGHT_COMPONENT_UTIL != 'false'
120126

121127
- name: Publish hyperlight-component-macro
122128
continue-on-error: ${{ inputs.dry_run }}
123129
run: cargo publish --manifest-path ./src/hyperlight_component_macro/Cargo.toml ${{ inputs.dry_run && '--dry-run' || '' }}
124130
env:
125-
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_PUBLISH_TOKEN }}
131+
CARGO_REGISTRY_TOKEN: ${{ steps.crates-io-auth.outputs.token }}
126132
if: env.PUBLISH_HYPERLIGHT_COMPONENT_MACRO != 'false'
127133

128134
- name: Publish hyperlight-host
129135
continue-on-error: ${{ inputs.dry_run }}
130136
run: cargo publish --manifest-path ./src/hyperlight_host/Cargo.toml ${{ inputs.dry_run && '--dry-run' || '' }}
131137
env:
132-
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_PUBLISH_TOKEN }}
138+
CARGO_REGISTRY_TOKEN: ${{ steps.crates-io-auth.outputs.token }}
133139
if: env.PUBLISH_HYPERLIGHT_HOST != 'false'
134140

135141

0 commit comments

Comments
 (0)