Skip to content

Commit 2ca33d8

Browse files
committed
Use trusted publisher with PyPi and blessed action
See https://docs.pypi.org/trusted-publishers/using-a-publisher/ and https://github.com/pypa/gh-action-pypi-publish. This avoids the need for an upload token after having configured our GitHub action as trusted publisher in our PyPi account. All API tokens have been removed from the account.
1 parent 6c3c130 commit 2ca33d8

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

.github/workflows/release-pypi.yaml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
steps:
1818
- uses: actions/checkout@v4
1919
- name: Install dependencies
20-
run: python3 -m pip install --upgrade pip build setuptools wheel twine
20+
run: python3 -m pip install --upgrade pip build setuptools wheel
2121
- name: Build pip package
2222
run: python3 -m build
2323
- name: Authenticate GitHub workflow to AWS
@@ -30,9 +30,6 @@ jobs:
3030
github_token="$(aws secretsmanager get-secret-value --secret-id RELEASE_CI_ACCESS_TOKEN | jq -r '.SecretString')"
3131
echo "::add-mask::$github_token"
3232
echo "GITHUB_TOKEN=$github_token" >> $GITHUB_ENV
33-
twine_password="$(aws secretsmanager get-secret-value --secret-id PYPI_ACCESS_TOKEN | jq -r '.SecretString')"
34-
echo "::add-mask::$twine_password"
35-
echo "TWINE_PASSWORD=$twine_password" >> $GITHUB_ENV
3633
- name: set asset path and name
3734
id: get_package_name
3835
run: |
@@ -41,7 +38,5 @@ jobs:
4138
uses: softprops/action-gh-release@v2
4239
with:
4340
files: dist/${{ steps.get_package_name.outputs.package_name }}
44-
- name: Upload to PyPi
45-
env:
46-
TWINE_USERNAME: __token__
47-
run: python3 -m twine upload dist/*
41+
- name: Publish package distributions to PyPI
42+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)