Skip to content

Commit 5ed88f7

Browse files
mgkwillMarcus G K Williams
authored and
Marcus G K Williams
committed
Further fix to pypi upload in cd.yml
Set contents to write in publish release
1 parent 5e2fa3d commit 5ed88f7

File tree

1 file changed

+9
-22
lines changed

1 file changed

+9
-22
lines changed

.github/workflows/cd.yml

+9-22
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,12 @@ jobs:
134134
name: Upload release artifact
135135
runs-on: ubuntu-latest
136136
if: github.triggering_actor == 'mgkwill' || github.triggering_actor == 'PhilippPlank' || github.triggering_actor == 'tim-shea'
137-
outputs:
138-
api-token: ${{ steps.mint-token.outputs.api-token}}
137+
environment:
138+
name: pypi
139+
url: https://pypi.org/p/lava-nc/
139140
permissions:
140-
contents: write
141-
id-token: write
141+
id-token: write
142+
contents: write
142143
needs: [build-artifacts, test-artifact-install, test-artifact-use]
143144

144145
steps:
@@ -184,26 +185,12 @@ jobs:
184185
generateReleaseNotes: true
185186
makeLatest: true
186187

187-
- name: Mint Github API token
188-
id: mint-token
189-
run: |
190-
# retrieve OIDC token
191-
resp=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
192-
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=pypi")
193-
oidc_token=$(jq '.value' <<< "${resp}")
194-
195-
# exchange OIDC token for API token
196-
resp=$(curl -X POST https://pypi.org/_/oidc/github/mint-token -d "{\"token\": \"${oidc_token}\"}")
197-
api_token=$(jq '.token' <<< "${resp}")
198-
199-
# mask the API token, to prevent leaking it
200-
echo "::add-mask::${api_token}"
201-
202-
echo "api-token=${api_token}" >> "${GITHUB_OUTPUT}"
203-
204188
- name: Publish to PyPI
205189
if: steps.check-version.outputs.prerelease != 'true'
206190
run: |
207191
mkdir dist
208192
cp lava* dist/.
209-
poetry publish -u __token__ -p '${{ steps.mint-token.outputs.api-token }}'
193+
194+
- name: Publish package distributions to PyPI
195+
if: steps.check-version.outputs.prerelease != 'true'
196+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)