File tree Expand file tree Collapse file tree
project_name/.github/workflows Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -137,12 +137,12 @@ format_tool:
137137
138138in_pypi :
139139 type : bool
140- help : Did you upload it to PyPI?
140+ help : Do you upload it to PyPI?
141141 default : false
142142
143143in_rtd :
144144 type : bool
145- help : Did you deploy the docs to Read the Docs?
145+ help : Do you deploy the docs to Read the Docs?
146146 default : false
147147
148148in_codecov :
Original file line number Diff line number Diff line change 1+ # Configure trusted publishing for this workflow. See:
2+ # https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
3+ name: Build and Publish
4+
5+ on:
6+ push:
7+ tags: ['v*']
8+ release:
9+ types: [published]
10+
11+ jobs:
12+ build:
13+ runs-on: ubuntu-latest
14+ steps:
15+ - uses: actions/checkout@v4
16+ with:
17+ persist-credentials: false
18+ - uses: astral-sh/setup-uv@v3
19+ - name: Build package
20+ run: uv build
21+ - name: Upload package distributions
22+ uses: actions/upload-artifact@v4
23+ with:
24+ name: python-package-distributions
25+ path: dist/
26+
27+ publish-to-testpypi:
28+ if: github.event_name == 'push'
29+ needs: [build]
30+ runs-on: ubuntu-latest
31+ environment:
32+ name: testpypi
33+ url: https://test.pypi.org/p/{{ project_name }}
34+ permissions:
35+ id-token: write
36+ steps:
37+ - name: Download package distributions
38+ uses: actions/download-artifact@v4
39+ with:
40+ name: python-package-distributions
41+ path: dist/
42+ - name: Publish distribution to TestPyPI
43+ uses: pypa/gh-action-pypi-publish@release/v1
44+ with:
45+ repository-url: https://test.pypi.org/legacy/
46+
47+ publish-to-pypi:
48+ if: github.event_name == 'release'
49+ needs: [build]
50+ runs-on: ubuntu-latest
51+ environment:
52+ name: pypi
53+ url: https://pypi.org/p/{{ project_name }}
54+ permissions:
55+ id-token: write
56+ steps:
57+ - name: Download package distributions
58+ uses: actions/download-artifact@v4
59+ with:
60+ name: python-package-distributions
61+ path: dist/
62+ - name: Publish distribution to PyPI
63+ uses: pypa/gh-action-pypi-publish@release/v1
You can’t perform that action at this time.
0 commit comments