Skip to content

Commit fb70768

Browse files
ci: add PyPI publish workflow (#15)
* Initial plan * Add publish-to-pypi.yml workflow for TestPyPI publishing on every commit to main Co-authored-by: deviantintegral <255023+deviantintegral@users.noreply.github.com> * Add publish-to-pypi job for production PyPI on GitHub release events Co-authored-by: deviantintegral <255023+deviantintegral@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: deviantintegral <255023+deviantintegral@users.noreply.github.com> Co-authored-by: Andrew Berry <andrew@furrypaws.ca>
1 parent 5941161 commit fb70768

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
release:
7+
types: [published]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
steps:
15+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
16+
- uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7
17+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
18+
with:
19+
python-version: "3.13"
20+
- run: uv build
21+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
22+
with:
23+
name: python-package-distributions
24+
path: dist/
25+
26+
publish-to-testpypi:
27+
needs: build
28+
if: github.event_name == 'push'
29+
runs-on: ubuntu-latest
30+
environment: testpypi
31+
permissions:
32+
id-token: write
33+
steps:
34+
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
35+
with:
36+
name: python-package-distributions
37+
path: dist/
38+
- uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
39+
with:
40+
repository-url: https://test.pypi.org/legacy/
41+
42+
publish-to-pypi:
43+
needs: build
44+
if: github.event_name == 'release'
45+
runs-on: ubuntu-latest
46+
environment: pypi
47+
permissions:
48+
id-token: write
49+
steps:
50+
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
51+
with:
52+
name: python-package-distributions
53+
path: dist/
54+
- uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0

0 commit comments

Comments
 (0)