File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -215,6 +215,9 @@ jobs:
215215 name : Publish to crates.io
216216 needs : create-release
217217 runs-on : ubuntu-latest
218+ environment : release
219+ permissions :
220+ id-token : write # Required for OIDC token exchange with crates.io
218221
219222 steps :
220223 - uses : actions/checkout@v4
@@ -234,10 +237,14 @@ jobs:
234237 fi
235238 echo "CARGO_VERSION=$CARGO_VERSION" >> $GITHUB_ENV
236239
240+ - name : Authenticate with crates.io
241+ uses : rust-lang/crates-io-auth-action@v1
242+ id : auth
243+
237244 - name : Publish to crates.io
238245 run : |
239246 # Try to publish, but don't fail if the version already exists
240- cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }} -- verbose || {
247+ cargo publish --verbose || {
241248 EXIT_CODE=$?
242249 # Check if it failed because the version already exists
243250 cargo search sql-schema --limit 1 | grep -q "sql-schema = \"$CARGO_VERSION\"" && {
@@ -248,4 +255,4 @@ jobs:
248255 exit $EXIT_CODE
249256 }
250257 env :
251- CARGO_REGISTRY_TOKEN : ${{ secrets.CARGO_REGISTRY_TOKEN }}
258+ CARGO_REGISTRY_TOKEN : ${{ steps.auth.outputs.token }}
You can’t perform that action at this time.
0 commit comments