1- # in cudmore, my twine key is in
2- # TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
3- # in mapmanager org
4- # TWINE_PASSWORD: ${{ secrets.TWINE_API_KEY }}
5-
6- name : Publish mapmanagercore to PyPi (cudmore)
1+ name : Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
72
83on : push
94
105jobs :
11- build :
12- name : Build distribution 📦
13- runs-on : ubuntu-latest
14-
15- steps :
16- - uses : actions/checkout@v4
17- - name : Set up Python
18- uses : actions/setup-python@v5
19- with :
20- python-version : " 3.x"
21- - name : Install pypa/build
22- run : >-
23- python3 -m
24- pip install
25- build
26- --user
27- - name : Build a binary wheel and a source tarball
28- run : python3 -m build
29- - name : Store the distribution packages
30- uses : actions/upload-artifact@v3
31- with :
32- name : python-package-distributions
33- path : dist/
34-
35- publish-to-pypi :
36- name : >-
37- Publish Python 🐍 distribution 📦 to PyPI
38- if : startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
39- needs :
40- - build
41- runs-on : ubuntu-latest
42- environment :
43- name : pypi
44- url : https://pypi.org/p/mapmanagercore # <package-name> # Replace <package-name> with your PyPI project name
45- permissions :
46- id-token : write # IMPORTANT: mandatory for trusted publishing
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 PyPI
55- uses : pypa/gh-action-pypi-publish@release/v1
56-
57- github-release :
58- name : >-
59- Sign the Python 🐍 distribution 📦 with Sigstore
60- and upload them to GitHub Release
61- needs :
62- - publish-to-pypi
63- runs-on : ubuntu-latest
64-
65- permissions :
66- contents : write # IMPORTANT: mandatory for making GitHub Releases
67- id-token : write # IMPORTANT: mandatory for sigstore
68-
69- steps :
70- - name : Download all the dists
71- uses : actions/download-artifact@v3
72- with :
73- name : python-package-distributions
74- path : dist/
75- - name : Sign the dists with Sigstore
76- uses : sigstore/gh-action-sigstore-python@v2.1.1
77- with :
78- inputs : >-
79- ./dist/*.tar.gz
80- ./dist/*.whl
81- - name : Create GitHub Release
82- env :
83- GITHUB_TOKEN : ${{ github.token }}
84- run : >-
85- gh release create
86- '${{ github.ref_name }}'
87- --repo '${{ github.repository }}'
88- --notes ""
89- - name : Upload artifact signatures to GitHub Release
90- env :
91- GITHUB_TOKEN : ${{ github.token }}
92- # Upload to GitHub Release using the `gh` CLI.
93- # `dist/` contains the built packages, and the
94- # sigstore-produced signatures and certificates.
95- run : >-
96- gh release upload
97- '${{ github.ref_name }}' dist/**
98- --repo '${{ github.repository }}'
99-
6+ build :
7+ name : Build distribution 📦
8+ runs-on : ubuntu-latest
9+
10+ steps :
11+ - uses : actions/checkout@v4
12+ - name : Set up Python
13+ uses : actions/setup-python@v5
14+ with :
15+ python-version : " 3.x"
16+ - name : Install pypa/build
17+ run : >-
18+ python3 -m
19+ pip install
20+ build
21+ --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@v3
26+ with :
27+ name : python-package-distributions
28+ path : dist/
29+
30+ publish-to-pypi :
31+ name : >-
32+ Publish Python 🐍 distribution 📦 to PyPI
33+ if : startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
34+ needs :
35+ - build
36+ runs-on : ubuntu-latest
37+ environment :
38+ name : pypi
39+ url : https://pypi.org/p/mapmanagercore # Replace <package-name> with your PyPI project name
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 PyPI
50+ uses : pypa/gh-action-pypi-publish@release/v1
51+
52+ github-release :
53+ name : >-
54+ Sign the Python 🐍 distribution 📦 with Sigstore
55+ and upload them to GitHub Release
56+ needs :
57+ - publish-to-pypi
58+ runs-on : ubuntu-latest
59+
60+ permissions :
61+ contents : write # IMPORTANT: mandatory for making GitHub Releases
62+ id-token : write # IMPORTANT: mandatory for sigstore
63+
64+ steps :
65+ - name : Download all the dists
66+ uses : actions/download-artifact@v3
67+ with :
68+ name : python-package-distributions
69+ path : dist/
70+ - name : Sign the dists with Sigstore
71+ uses : sigstore/gh-action-sigstore-python@v2.1.1
72+ with :
73+ inputs : >-
74+ ./dist/*.tar.gz
75+ ./dist/*.whl
76+ - name : Create GitHub Release
77+ env :
78+ GITHUB_TOKEN : ${{ github.token }}
79+ run : >-
80+ gh release create
81+ '${{ github.ref_name }}'
82+ --repo '${{ github.repository }}'
83+ --notes ""
84+ - name : Upload artifact signatures to GitHub Release
85+ env :
86+ GITHUB_TOKEN : ${{ github.token }}
87+ # Upload to GitHub Release using the `gh` CLI.
88+ # `dist/` contains the built packages, and the
89+ # sigstore-produced signatures and certificates.
90+ run : >-
91+ gh release upload
92+ '${{ github.ref_name }}' dist/**
93+ --repo '${{ github.repository }}'
94+
95+ publish-to-testpypi :
96+ name : Publish Python 🐍 distribution 📦 to TestPyPI
97+ needs :
98+ - build
99+ runs-on : ubuntu-latest
100+
101+ environment :
102+ name : testpypi
103+ url : https://test.pypi.org/p/mapmanagercore
104+ permissions :
105+ id-token : write # IMPORTANT: mandatory for trusted publishing
106+
107+ steps :
108+ - name : Download all the dists
109+ uses : actions/download-artifact@v3
110+ with :
111+ name : python-package-distributions
112+ path : dist/
113+ - name : Publish distribution 📦 to TestPyPI
114+ uses : pypa/gh-action-pypi-publish@release/v1
115+ with :
116+ repository-url : https://test.pypi.org/legacy/
0 commit comments