Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 2 additions & 19 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,5 @@ jobs:
python3 -m build
python3 -m twine check dist/*

- name: Publish to PyPI
env:
PYPI_OIDC_AUDIENCE: pypi
run: |
set -euo pipefail

oidc_response=$(curl --fail-with-body --silent --show-error \
-H "Authorization: bearer ${ACTIONS_ID_TOKEN_REQUEST_TOKEN}" \
"${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=${PYPI_OIDC_AUDIENCE}")
oidc_token=$(jq --raw-output '.value' <<< "${oidc_response}")

token_response=$(curl --fail-with-body --silent --show-error \
-X POST https://pypi.org/_/oidc/mint-token \
-H 'Content-Type: application/json' \
--data "$(jq --null-input --arg token "${oidc_token}" '{token: $token}')")
api_token=$(jq --raw-output '.token' <<< "${token_response}")

echo "::add-mask::${api_token}"
TWINE_USERNAME=__token__ TWINE_PASSWORD="${api_token}" python3 -m twine upload dist/*
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1