File tree Expand file tree Collapse file tree 1 file changed +25
-5
lines changed
Expand file tree Collapse file tree 1 file changed +25
-5
lines changed Original file line number Diff line number Diff line change 5656 - name : Install twine
5757 run : python -m pip install twine
5858
59- - name : upload wheels
60- env :
61- TWINE_USERNAME : ${{ secrets.TWINE_USERNAME }}
62- TWINE_PASSWORD : ${{ secrets.TWINE_PASSWORD }}
63- run : twine upload wheelhouse/* --verbose
59+ - name : mint API token
60+ id : mint-token
61+ run : |
62+ # retrieve the ambient OIDC token
63+ resp=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
64+ "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=pypi")
65+ oidc_token=$(jq -r '.value' <<< "${resp}")
66+
67+ # exchange the OIDC token for an API token
68+ resp=$(curl -X POST https://pypi.org/_/oidc/mint-token -d "{\"token\": \"${oidc_token}\"}")
69+ api_token=$(jq -r '.token' <<< "${resp}")
70+
71+ # mask the newly minted API token, so that we don't accidentally leak it
72+ echo "::add-mask::${api_token}"
73+
74+ # see the next step in the workflow for an example of using this step output
75+ echo "api-token=${api_token}" >> "${GITHUB_OUTPUT}"
76+
77+ TWINE_USERNAME=__token__ TWINE_PASSWORD=${api_token} twine upload wheelhouse/* --verbose
78+
79+ # - name: upload wheels
80+ # env:
81+ # TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
82+ # TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
83+ # run: twine upload wheelhouse/* --verbose
You can’t perform that action at this time.
0 commit comments