Skip to content

Commit 498b23a

Browse files
committed
update publish workflow
1 parent a78d494 commit 498b23a

File tree

2 files changed

+71
-37
lines changed

2 files changed

+71
-37
lines changed

.github/workflows/publish.yml

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

.github/workflows/python-publish.yml

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

0 commit comments

Comments
 (0)