1+ name : Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
2+
3+ on :
4+ push :
5+ branches :
6+ - master
7+ workflow_dispatch :
8+
9+ jobs :
10+ build :
11+ name : Build distribution 📦
12+ runs-on : ubuntu-latest
13+
14+ steps :
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 pypa/build
21+ run : >-
22+ python3 -m
23+ pip install
24+ build
25+ --user
26+ - name : Build a binary wheel and a source tarball
27+ run : python3 -m build
28+ - name : Store the distribution packages
29+ uses : actions/upload-artifact@v3
30+ with :
31+ name : python-package-distributions
32+ path : dist/
33+
34+ publish-to-testpypi :
35+ name : Publish Python 🐍 distribution 📦 to TestPyPI
36+ if : startsWith(github.ref, 'refs/tags/')
37+ needs :
38+ - build
39+ runs-on : ubuntu-latest
40+
41+ environment :
42+ name : testpypi
43+ url : https://test.pypi.org/p/comiclib
44+
45+ permissions :
46+ id-token : write
47+
48+ steps :
49+ - name : Download all the dists
50+ uses : actions/download-artifact@v3
51+ with :
52+ name : python-package-distributions
53+ path : dist/
54+ - name : Publish distribution 📦 to TestPyPI
55+ uses : pypa/gh-action-pypi-publish@release/v1
56+ with :
57+ repository-url : https://test.pypi.org/legacy/
58+
59+ publish-to-pypi :
60+ name : >-
61+ Publish Python 🐍 distribution 📦 to PyPI
62+ if : startsWith(github.ref, 'refs/tags/')
63+ needs :
64+ - build
65+ runs-on : ubuntu-latest
66+ environment :
67+ name : pypi
68+ url : https://pypi.org/p/comiclib
69+ permissions :
70+ id-token : write
71+
72+ steps :
73+ - name : Download all the dists
74+ uses : actions/download-artifact@v3
75+ with :
76+ name : python-package-distributions
77+ path : dist/
78+ - name : Publish distribution 📦 to PyPI
79+ uses : pypa/gh-action-pypi-publish@release/v1
0 commit comments