Skip to content

Commit 4aab1e3

Browse files
committed
update publish actions to use trusted publisher
1 parent 0144a00 commit 4aab1e3

File tree

2 files changed

+52
-9
lines changed

2 files changed

+52
-9
lines changed

.github/workflows/publish-pypi.yml

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
workflow_dispatch:
66

77
jobs:
8-
publish:
8+
build:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Check out repository
@@ -25,8 +25,30 @@ jobs:
2525
- name: Build package
2626
run: python -m build
2727

28-
- name: Publish to PyPI
28+
- name: Upload distributions
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: release-dists
32+
path: dist/
33+
34+
publish:
35+
runs-on: ubuntu-latest
36+
needs:
37+
- build
38+
permissions:
39+
id-token: write # required for trusted publishing
40+
environment:
41+
name: pypi
42+
url: https://pypi.org/p/orthority
43+
44+
steps:
45+
- name: Retrieve distribution
46+
uses: actions/download-artifact@v4
47+
with:
48+
name: release-dists
49+
path: dist/
50+
51+
- name: Publish distribution
2952
uses: pypa/gh-action-pypi-publish@release/v1
3053
with:
31-
user: __token__
32-
password: ${{ secrets.PYPI_TOKEN }}
54+
packages-dir: dist/

.github/workflows/publish-testpypi.yml

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
workflow_dispatch:
44

55
jobs:
6-
publish:
6+
build:
77
runs-on: ubuntu-latest
88
steps:
99
- name: Check out repository
@@ -23,9 +23,30 @@ jobs:
2323
- name: Build package
2424
run: python -m build
2525

26-
- name: Publish to TestPyPI
26+
- name: Upload distributions
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: release-dists
30+
path: dist/
31+
32+
publish:
33+
runs-on: ubuntu-latest
34+
needs:
35+
- build
36+
permissions:
37+
id-token: write # required for trusted publishing
38+
environment:
39+
name: pypi
40+
url: https://test.pypi.org/p/orthority
41+
42+
steps:
43+
- name: Retrieve distribution
44+
uses: actions/download-artifact@v4
45+
with:
46+
name: release-dists
47+
path: dist/
48+
49+
- name: Publish distribution
2750
uses: pypa/gh-action-pypi-publish@release/v1
2851
with:
29-
user: __token__
30-
password: ${{ secrets.TEST_PYPI_TOKEN }}
31-
repository_url: https://test.pypi.org/legacy/
52+
packages-dir: dist/

0 commit comments

Comments
 (0)