Skip to content

Commit 6d2bdfc

Browse files
committed
Use OpenID Connect for package publishing
Signed-off-by: Keith Battocchi <[email protected]>
1 parent 7830c47 commit 6d2bdfc

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

.github/workflows/publish-package.yml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -117,25 +117,17 @@ jobs:
117117
publish:
118118
name: Publish to PyPI or TestPyPI
119119
needs: [merge]
120+
permissions:
121+
id-token: write
122+
if: ${{ inputs.publish }}
120123
runs-on: ubuntu-latest
121124
steps:
122-
- name: Setup Python
123-
uses: actions/setup-python@v5
124-
with:
125-
python-version: 3.9
126-
- name: Ensure latest pip and setuptools
127-
run: python -m pip install --upgrade pip && pip install --upgrade setuptools
128-
- name: Install twine
129-
run: pip install twine
130125
- name: Download wheels and sdist
131126
uses: actions/download-artifact@v4
132127
with:
133128
name: dist
134129
path: dist/
135130
- name: Upload wheels and sdist to package index
136-
run: twine upload dist/*
137-
env:
138-
TWINE_USERNAME: __token__
139-
TWINE_REPOSITORY: ${{ inputs.repository }}
140-
TWINE_PASSWORD: ${{ inputs.repository == 'pypi' && secrets.PYPI_UPLOAD_TOKEN || secrets.TEST_PYPI_UPLOAD_TOKEN }}
141-
if: ${{ inputs.publish }}
131+
uses: pypa/gh-action-pypi-publish@release/v1
132+
with:
133+
repository-url: ${{ inputs.repository == 'testpypi' && 'https://test.pypi.org/legacy/' || '' }}

0 commit comments

Comments
 (0)