Skip to content

Commit 95b429a

Browse files
committed
PyPI
1 parent cfd9739 commit 95b429a

2 files changed

Lines changed: 105 additions & 0 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Publish to PyPI
2+
on: release
3+
4+
jobs:
5+
build:
6+
name: Build distribution
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v6
11+
with:
12+
persist-credentials: false
13+
14+
- name: Set up Python
15+
uses: actions/setup-python@v6
16+
with:
17+
python-version: "3.x"
18+
19+
- name: Install pypa/build
20+
run: python3 -m pip install --user build
21+
22+
- name: Build a binary wheel and a source tarball
23+
run: python3 -m build
24+
25+
- name: Store the distribution packages
26+
uses: actions/upload-artifact@v5
27+
with:
28+
name: python-package-distributions
29+
path: dist/
30+
31+
publish-to-pypi:
32+
name: Publish Python distribution to PyPI
33+
needs:
34+
- build
35+
runs-on: ubuntu-latest
36+
environment:
37+
name: pypi
38+
url: https://pypi.org/p/pathspec
39+
permissions:
40+
id-token: write # IMPORTANT: mandatory for trusted publishing
41+
42+
steps:
43+
- name: Download all the dists
44+
uses: actions/download-artifact@v6
45+
with:
46+
name: python-package-distributions
47+
path: dist/
48+
49+
- name: Publish distribution to PyPI
50+
uses: pypa/gh-action-pypi-publish@v1.13.0
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Publish to TestPyPI
2+
on:
3+
push:
4+
branches:
5+
- master
6+
7+
jobs:
8+
build:
9+
name: Build distribution
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v6
14+
with:
15+
persist-credentials: false
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v6
19+
with:
20+
python-version: "3.x"
21+
22+
- name: Install pypa/build
23+
run: python3 -m pip install --user build
24+
25+
- name: Build a binary wheel and a source tarball
26+
run: python3 -m build
27+
28+
- name: Store the distribution packages
29+
uses: actions/upload-artifact@v5
30+
with:
31+
name: python-package-distributions
32+
path: dist/
33+
34+
publish-to-testpypi:
35+
name: Publish Python distribution to TestPyPI
36+
needs:
37+
- build
38+
runs-on: ubuntu-latest
39+
environment:
40+
name: testpypi
41+
url: https://test.pypi.org/p/pathspec
42+
permissions:
43+
id-token: write # IMPORTANT: mandatory for trusted publishing
44+
45+
steps:
46+
- name: Download all the dists
47+
uses: actions/download-artifact@v6
48+
with:
49+
name: python-package-distributions
50+
path: dist/
51+
52+
- name: Publish distribution to TestPyPI
53+
uses: pypa/gh-action-pypi-publish@v1.13.0
54+
with:
55+
repository-url: https://test.pypi.org/legacy/

0 commit comments

Comments
 (0)