Skip to content

Commit 46982f2

Browse files
committed
Add Publishing workflow
1 parent 2bba567 commit 46982f2

File tree

1 file changed

+69
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)