Skip to content

Commit

Permalink
Test commit.
Browse files Browse the repository at this point in the history
Signed-off-by: Bhupender <[email protected]>
  • Loading branch information
Bhupender-Y committed Nov 30, 2023
1 parent 91a47ce commit 33d336d
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions .github/workflows/tagPublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,27 +68,31 @@ jobs:
- name: build source
id: build_source
run: python -u .github/workflows/build_source.py
- name: mint API token
id: mint-token
run: |
# retrieve the ambient OIDC token
resp=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=testpypi")
oidc_token=$(jq '.value' <<< "${resp}")
# exchange the OIDC token for an API token
resp=$(curl -X POST https://pypi.org/_/oidc/github/mint-token -d "{\"token\": \"${oidc_token}\"}")
api_token=$(jq '.token' <<< "${resp}")
# mask the newly minted API token, so that we don't accidentally leak it
echo ${api_token}
echo "::add-mask::${api_token}"
# see the next step in the workflow for an example of using this step output
echo "api-token=${api_token}" >> "${GITHUB_OUTPUT}"
- name: Publish to pypi
env:
# the username and the repository needs to be changed before release.
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ steps.mint-token.outputs.api-token }}
TWINE_REPOSITORY: testpypi
run: |
# retrieve the ambient OIDC token
resp=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=testpypi")
oidc_token=$(jq '.value' <<< "${resp}")
# exchange the OIDC token for an API token
resp=$(curl -X POST https://pypi.org/_/oidc/github/mint-token -d "{\"token\": \"${oidc_token}\"}")
api_token=$(jq '.token' <<< "${resp}")
# mask the newly minted API token, so that we don't accidentally leak it
echo "::add-mask::${api_token}"
# see the next step in the workflow for an example of using this step output
echo "api-token=${api_token}" >> "${GITHUB_OUTPUT}"
TWINE_PASSWORD="${api_token}"
pip install -U twine
python -m twine upload --skip-existing target/wheels/*
- name: Upload to Github releases
Expand Down

0 comments on commit 33d336d

Please sign in to comment.