File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -181,12 +181,29 @@ jobs:
181181 generateReleaseNotes : true
182182 makeLatest : true
183183
184+ - name : Mint Github API token
185+ id : mint-token
186+ run : |
187+ # retrieve the ambient OIDC token
188+ resp=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
189+ "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=pypi")
190+ oidc_token=$(jq '.value' <<< "${resp}")
191+
192+ # exchange the OIDC token for an API token
193+ resp=$(curl -X POST https://pypi.org/_/oidc/github/mint-token -d "{\"token\": \"${oidc_token}\"}")
194+ api_token=$(jq '.token' <<< "${resp}")
195+
196+ # mask the newly minted API token, so that we don't accidentally leak it
197+ echo "::add-mask::${api_token}"
198+
199+ # see the next step in the workflow for an example of using this step output
200+ echo "api-token=${api_token}" >> "${GITHUB_OUTPUT}"
201+
184202 - name : Publish to PyPI
185203 if : steps.check-version.outputs.prerelease != 'true'
186204 env :
187- POETRY_PYPI_TOKEN_PYPI : ${{ secrets.PYPI_TOKEN }}
205+ POETRY_PYPI_TOKEN_PYPI : ${{ steps.mint-token.outputs.api-token }}
188206 run : |
189207 mkdir dist
190208 cp lava* dist/.
191- # poetry config repositories.testpypi https://test.pypi.org/legacy/
192209 poetry publish --dry-run
You can’t perform that action at this time.
0 commit comments