File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ permissions:
4343jobs :
4444 release :
4545 name : Release
46+ environment : npm
4647 permissions :
4748 contents : write
4849 # To publish packages with provenance
@@ -67,13 +68,33 @@ jobs:
6768
6869 - name : Run Test
6970 run : pnpm run test
70-
71+ - name : Obtain OIDC token
72+ id : oidc
73+ run : |
74+ token=$(curl --fail -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
75+ "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=cfa.rspack.dev" | jq -r '.value')
76+ echo "::add-mask::${token}"
77+ echo "token=${token}" >> $GITHUB_OUTPUT
78+ shell : bash
79+ - name : Obtain GitHub credentials
80+ id : github_creds
81+ run : |
82+ token=$(curl --fail "https://cfa.rspack.dev/api/request/${{ secrets.CFA_PROJECT_ID }}/github/credentials" \
83+ -X POST \
84+ -H "Content-Type: application/json" \
85+ -H "Authorization: bearer ${{ secrets.CFA_SECRET }}" \
86+ --data "{\"token\":\"${{ steps.oidc.outputs.token }}\"}" | jq -r '.GITHUB_TOKEN')
87+ echo "::add-mask::${token}"
88+ echo "token=${token}" >> $GITHUB_OUTPUT
89+ shell : bash
7190 - name : Try release to npm
7291 run : pnpm run release
7392 env :
7493 DRY_RUN : ${{ inputs.dry_run }}
7594 TAG : ${{ inputs.tag }}
7695 VERSION : ${{ inputs.version }}
96+ GITHUB_TOKEN : ${{ steps.github_creds.outputs.token }}
97+ GITHUB_OIDC_TOKEN : ${{ steps.oidc.outputs.token }}
7798 NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
7899
79100
You can’t perform that action at this time.
0 commit comments