Skip to content

Commit 682fa8a

Browse files
authored
Merge pull request #133 from aryan-neogi/add-pypi-publish-workflow
ci: add GitHub Actions workflow to publish to PyPI on new release (#125)
2 parents 0ff55b7 + 0891983 commit 682fa8a

1 file changed

Lines changed: 63 additions & 0 deletions

File tree

.github/workflows/publish.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
name: "Publish Python Package to PyPI on new Release"
3+
4+
"on":
5+
release:
6+
types: ["created"]
7+
8+
env:
9+
UV_PYTHON_DOWNLOADS: 0
10+
11+
jobs:
12+
build:
13+
name: "Build distribution"
14+
runs-on: ubuntu-latest
15+
permissions: {}
16+
steps:
17+
- name: "Checkout"
18+
uses: actions/checkout@v4
19+
with:
20+
persist-credentials: false
21+
22+
- name: "Set up Python 3.12"
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.12"
26+
27+
- name: "Install uv"
28+
uses: astral-sh/setup-uv@v4
29+
with:
30+
enable-cache: false
31+
32+
- name: "Build"
33+
run: uv build
34+
35+
- name: "Upload artifact"
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: python-package-distributions
39+
path: dist/*
40+
41+
publish:
42+
name: "Publish to PyPI"
43+
needs: build
44+
runs-on: ubuntu-latest
45+
environment:
46+
name: pypi
47+
permissions:
48+
id-token: write
49+
contents: read
50+
steps:
51+
- name: "Download artifact"
52+
uses: actions/download-artifact@v4
53+
with:
54+
name: python-package-distributions
55+
path: dist/
56+
57+
- name: "Install uv"
58+
uses: astral-sh/setup-uv@v4
59+
with:
60+
enable-cache: false
61+
62+
- name: "Publish"
63+
run: uv publish

0 commit comments

Comments
 (0)