Skip to content

Commit b023b46

Browse files
update workflows
1 parent 600a28b commit b023b46

File tree

2 files changed

+57
-4
lines changed

2 files changed

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

.github/workflows/publish-to-test-pypi.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
22

3-
on:
4-
release:
5-
types: [published]
3+
on: push
64

75
permissions:
86
contents: read
@@ -41,7 +39,7 @@ jobs:
4139

4240
environment:
4341
name: testpypi
44-
url: https://test.pypi.org/p/mdc-regression
42+
url: https://test.pypi.org/p/mcd-regression
4543

4644
permissions:
4745
id-token: write # IMPORTANT: mandatory for trusted publishing

0 commit comments

Comments
 (0)