Skip to content

Commit 603425f

Browse files
committed
Update PyPI publishing mechanism
1 parent d8f23c9 commit 603425f

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55

66
name: CI
77

8+
permissions:
9+
contents: read
10+
id-token: write
11+
812
on:
913
push:
1014
branches:
@@ -881,15 +885,12 @@ jobs:
881885
RELEASE_VERSION: ${{ needs.test_packaging.outputs.version }}
882886
run: publish_github_release
883887

884-
- name: Publish PyPI release
888+
- name: Publish release to PyPI (Trusted Publishing)
885889
if: needs.analyze.outputs.release_type == 'tagged'
886-
env:
887-
TWINE_NON_INTERACTIVE: 1
888-
TWINE_USERNAME: __token__
889-
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
890-
# Optional: twine will fallback to default if empty.
891-
TWINE_REPOSITORY_URL: ${{ secrets.PYPI_URL }}
892-
run: publish_pypi_release
890+
uses: pypa/gh-action-pypi-publish@release/v1
891+
with:
892+
packages-dir: dist
893+
skip-existing: true
893894
# }}}
894895

895896
# vim: foldmethod=marker foldlevel=0

.github/workflows/ci/workflow_template.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
12
name: CI
23

4+
permissions:
5+
contents: read
6+
id-token: write
7+
38
on:
49
push:
510
branches:
@@ -307,15 +312,12 @@ jobs:
307312
RELEASE_VERSION: ${{ needs.test_packaging.outputs.version }}
308313
run: publish_github_release
309314

310-
- name: Publish PyPI release
315+
- name: Publish release to PyPI (Trusted Publishing)
311316
if: needs.analyze.outputs.release_type == 'tagged'
312-
env:
313-
TWINE_NON_INTERACTIVE: 1
314-
TWINE_USERNAME: __token__
315-
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
316-
# Optional: twine will fallback to default if empty.
317-
TWINE_REPOSITORY_URL: ${{ secrets.PYPI_URL }}
318-
run: publish_pypi_release
317+
uses: pypa/gh-action-pypi-publish@release/v1
318+
with:
319+
packages-dir: dist
320+
skip-existing: true
319321
# }}}
320322

321323
# vim: foldmethod=marker foldlevel=0

0 commit comments

Comments
 (0)