Skip to content

Commit 2306093

Browse files
committed
Adds PyPI build-and-publish workflow
1 parent 7f6fbb9 commit 2306093

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Build and Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
build-and-test:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Install uv
17+
uses: astral-sh/setup-uv@v5
18+
with:
19+
enable-cache: true
20+
21+
- name: Set up Python 3.9
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: '3.9'
25+
26+
- name: Install Dependencies
27+
run: uv sync --locked --dev
28+
29+
- name: Run Tests
30+
run: uv run pytest
31+
32+
- name: Run Code Formatting Checks
33+
run: uv run ruff check
34+
35+
- name: Build Package
36+
run: uv build
37+
38+
- name: Store the distribution files
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: python-package-distributions
42+
path: dist/
43+
44+
publish-to-pypi:
45+
needs: [build-and-test]
46+
runs-on: ubuntu-latest
47+
48+
permissions:
49+
id-token: write
50+
51+
steps:
52+
- name: Download the distribution files
53+
uses: actions/download-artifact@v4
54+
with:
55+
name: python-package-distributions
56+
path: dist/
57+
58+
- name: Publish package to PyPI
59+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)