Skip to content

Commit 24c7072

Browse files
authored
Merge pull request #5 from byu-oit/pypi-oidc
ci: oidc publish action
2 parents 80e2554 + 7768004 commit 24c7072

File tree

1 file changed

+39
-7
lines changed

1 file changed

+39
-7
lines changed

.github/workflows/publish-pypi.yaml

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,48 @@ on:
66
name: release
77

88
jobs:
9-
pypi-publish:
10-
name: Upload release to PyPI
9+
build:
10+
name: Build distribution 📦
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
persist-credentials: false
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.x"
21+
- name: Install pypa/build
22+
run: >-
23+
python3 -m
24+
pip install
25+
build
26+
--user
27+
- name: Build a binary wheel and a source tarball
28+
run: python3 -m build
29+
- name: Store the distribution packages
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: python-package-distributions
33+
path: dist/
34+
publish-to-pypi:
35+
name: >-
36+
Publish Python 🐍 distribution 📦 to PyPI
37+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
38+
needs:
39+
- build
1140
runs-on: ubuntu-latest
1241
environment:
1342
name: release
14-
url: https://pypi.org/p/byu-jwt-python
43+
url: https://pypi.org/p/byu-jwt
1544
permissions:
16-
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
45+
id-token: write # IMPORTANT: mandatory for trusted publishing
1746
steps:
18-
# retrieve your distributions here
19-
20-
- name: Publish package distributions to PyPI
47+
- name: Download all the dists
48+
uses: actions/download-artifact@v4
49+
with:
50+
name: python-package-distributions
51+
path: dist/
52+
- name: Publish distribution 📦 to PyPI
2153
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)