Skip to content

Commit 382ff13

Browse files
update workflow; testpypi
1 parent e34d6cf commit 382ff13

File tree

1 file changed

+43
-15
lines changed

1 file changed

+43
-15
lines changed

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

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,58 @@
99

1010
name: Upload Python Package
1111

12-
on:
13-
release:
14-
types: [published]
12+
on: push
1513

1614
permissions:
1715
contents: read
1816

1917
jobs:
20-
deploy:
21-
18+
build:
19+
name: Build distribution
2220
runs-on: ubuntu-latest
23-
permissions:
24-
id-token: write
21+
2522
steps:
2623
- uses: actions/checkout@v4
24+
with:
25+
persist-credentials: false
2726
- name: Set up Python
2827
uses: actions/setup-python@v5
2928
with:
30-
python-version: '3.11'
31-
- name: Install dependencies
32-
run: |
33-
python -m pip install --upgrade pip
34-
pip install build
35-
- name: Build package
36-
run: python -m build
37-
- name: Publish package
29+
python-version: "3.x"
30+
- name: Install pypa/build
31+
run: >-
32+
python3 -m
33+
pip install
34+
build
35+
--user
36+
- name: Build a binary wheel and a source tarball
37+
run: python3 -m build
38+
- name: Store the distribution packages
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: python-package-distributions
42+
path: dist/
43+
44+
publish-to-testpypi:
45+
name: Publish Python distribution to TestPyPI
46+
needs:
47+
- build
48+
runs-on: ubuntu-latest
49+
50+
environment:
51+
name: testpypi
52+
url: https://test.pypi.org/p/mcd-regression
53+
54+
permissions:
55+
id-token: write # IMPORTANT: mandatory for trusted publishing
56+
57+
steps:
58+
- name: Download all the dists
59+
uses: actions/download-artifact@v4
60+
with:
61+
name: python-package-distributions
62+
path: dist/
63+
- name: Publish distribution to TestPyPI
3864
uses: pypa/gh-action-pypi-publish@release/v1
65+
with:
66+
repository-url: https://test.pypi.org/legacy/

0 commit comments

Comments
 (0)