8000 MAINT: push to TestPyPI and PyPI automatically on tagged pushes · larray-project/larray@5381040 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5381040

Browse files
committed
MAINT: push to TestPyPI and PyPI automatically on tagged pushes
1 parent 5455fd1 commit 5381040

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

.github/workflows/release.yml

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

0 commit comments

Comments
 (0)
0