Skip to content

Commit

Permalink
Fix pypi publish in cd.yml (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgkwill authored Nov 14, 2023
1 parent 3414166 commit 1cf00b1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ jobs:
name: Upload release artifact
runs-on: ubuntu-latest
if: github.triggering_actor == 'mgkwill' || github.triggering_actor == 'PhilippPlank' || github.triggering_actor == 'tim-shea'
outputs:
api-token: ${{ steps.mint-token.outputs.api-token}}
permissions:
contents: write
id-token: write
Expand Down Expand Up @@ -185,26 +187,24 @@ jobs:
- name: Mint Github API token
id: mint-token
run: |
# retrieve the ambient OIDC token
# retrieve OIDC token
resp=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=pypi")
oidc_token=$(jq '.value' <<< "${resp}")
# exchange the OIDC token for an API token
# exchange OIDC token for 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
# mask the API token, to prevent leaking 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}"
- name: Publish to PyPI
if: steps.check-version.outputs.prerelease != 'true'
env:
POETRY_PYPI_TOKEN_PYPI: ${{ steps.mint-token.outputs.api-token }}
run: |
poetry config pypi-token.pypi ${{ steps.mint-token.outputs.api-token }}
mkdir dist
cp lava* dist/.
poetry publish
poetry publish

0 comments on commit 1cf00b1

Please sign in to comment.