Skip to content

Commit fe1d7f9

Browse files
committed
update publish workflow
1 parent 3405150 commit fe1d7f9

1 file changed

Lines changed: 19 additions & 64 deletions

File tree

.github/workflows/publish.yml

Lines changed: 19 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,28 @@
11
name: 📦 Publish Python Package
22
on:
3-
push:
4-
branches:
5-
- main
6-
3+
release:
4+
types: [created]
75
jobs:
8-
build:
9-
name: Build distribution
10-
runs-on: ubuntu-latest
11-
12-
steps:
13-
- uses: actions/checkout@v3
14-
with:
15-
persist-credentials: false
16-
- name: Set up Python
17-
uses: actions/setup-python@v5
18-
with:
19-
python-version: ["3.10", "3.11", "3.12"]
20-
- name: Install pypi/build
21-
run: python3 -m pip install build --user
22-
- name: Build a binary wheel and a source tarball
23-
run: python3 -m build
24-
- name: Store the distribution packages
25-
uses: actions/upload-artifact@v4
26-
with:
27-
name: python-package-distributions
28-
path: dist/
29-
30-
publish-to-pypi:
31-
name: Publish Python distribution to PyPI
32-
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
33-
needs:
34-
- build
6+
pypi-publish:
7+
name: Publish release to PyPI
358
runs-on: ubuntu-latest
369
environment:
3710
name: pypi
3811
url: https://pypi.org/p/mmore
3912
permissions:
40-
id-token: write # IMPORTANT: mandatory for trusted publishing
41-
42-
steps:
43-
- name: Download all the dists
44-
uses: actions/download-artifact@v4
45-
with:
46-
name: python-package-distributions
47-
path: dist/
48-
- name: Publish distribution 📦 to PyPI
49-
uses: pypa/gh-action-pypi-publish@release/v1
50-
51-
publish-to-testpypi:
52-
name: Publish Python distribution to TestPyPI
53-
needs:
54-
- build
55-
runs-on: ubuntu-latest
56-
57-
environment:
58-
name: testpypi
59-
url: https://test.pypi.org/p/mmore
60-
61-
permissions:
62-
id-token: write # IMPORTANT: mandatory for trusted publishing
63-
13+
id-token: write
6414
steps:
65-
- name: Download all the dists
66-
uses: actions/download-artifact@v4
67-
with:
68-
name: python-package-distributions
69-
path: dist/
70-
- name: Publish distribution to TestPyPI
71-
uses: pypa/gh-action-pypi-publish@release/v1
72-
with:
73-
repository-url: https://test.pypi.org/legacy/
15+
- uses: actions/checkout@v4
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: "3.x"
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install setuptools wheel
24+
- name: Build package
25+
run: |
26+
python setup.py sdist bdist_wheel # Could also be python -m build
27+
- name: Publish package distributions to PyPI
28+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)