Skip to content

Commit 4028c00

Browse files
committed
update github action for publishing
1 parent 13adce2 commit 4028c00

File tree

3 files changed

+72
-63
lines changed

3 files changed

+72
-63
lines changed

.github/workflows/publish-pypi.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.github/workflows/publish-test-pypi.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Upload Python Package
2+
3+
on:
4+
push:
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
build:
10+
name: Build distribution
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Set up Python
15+
uses: actions/setup-python@v4
16+
with:
17+
python-version: '3.11'
18+
- name: Install pypa/build
19+
run: |
20+
python -m pip install --upgrade pip
21+
pip install build --user
22+
- name: Build binary wheel and a source tarball
23+
run: python -m build
24+
- name: Store the distribution packages
25+
uses: actions/upload-artifact@v3
26+
with:
27+
name: python-package-distributions
28+
path: dist/
29+
30+
publish-to-testpypi:
31+
name: Publish to TestPyPI
32+
if: github.event_name == 'release'
33+
needs:
34+
- build
35+
runs-on: ubuntu-latest
36+
37+
environment:
38+
name: testpypi
39+
url: https://test.pypi.org/p/pyrp3
40+
41+
permissions:
42+
id-token: write # IMPORTANT: mandatory for trusted publishing
43+
44+
steps:
45+
- name: Download all the dists
46+
uses: actions/download-artifact@v3
47+
with:
48+
name: python-package-distributions
49+
path: dist/
50+
- name: Publish distribution to TestPyPI
51+
uses: pypa/gh-action-pypi-publish@release/v1
52+
with:
53+
repository-url: https://test.pypi.org/legacy/
54+
55+
publish-to-pypi:
56+
name: Publish to PyPI
57+
if: github.event_name == 'release' && !github.event.release.prerelease
58+
needs: build
59+
runs-on: ubuntu-latest
60+
environment:
61+
name: pypi
62+
url: https://pypi.org/project/pyrp3
63+
permissions:
64+
id-token: write # IMPORTANT: mandatory for trusted publishing
65+
steps:
66+
- name: Download distributions
67+
uses: actions/download-artifact@v3
68+
with:
69+
name: python-package-distributions
70+
path: dist/
71+
- name: Publish to PyPI
72+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)