Skip to content

Commit 6ae4453

Browse files
committed
add release workflow
1 parent 1125a9d commit 6ae4453

File tree

1 file changed

+77
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)