Skip to content

Commit 932bd10

Browse files
committed
CI: Add publish job
1 parent e1a1036 commit 932bd10

1 file changed

Lines changed: 32 additions & 2 deletions

File tree

.github/workflows/main.yml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ on:
77
# manually triggered
88

99
jobs:
10-
build:
11-
10+
test:
1211
runs-on: ubuntu-latest
1312
strategy:
1413
matrix:
@@ -32,3 +31,34 @@ jobs:
3231
uv venv
3332
uv pip install ".[testing]"
3433
.venv/bin/pytest tests
34+
35+
publish:
36+
if: startsWith(github.ref, 'refs/tags/')
37+
needs: test
38+
runs-on: ubuntu-latest
39+
environment: release
40+
permissions:
41+
id-token: write
42+
43+
steps:
44+
- name: Checkout repository
45+
uses: actions/checkout@v4
46+
with:
47+
fetch-depth: 0
48+
49+
- name: Set up Python
50+
uses: actions/setup-python@v5
51+
with:
52+
python-version: "3.11"
53+
54+
- name: Install hatch
55+
run: pip install hatch
56+
57+
- name: Build package
58+
run: hatch build
59+
60+
- name: Publish to PyPI
61+
uses: pypa/gh-action-pypi-publish@release/v1
62+
with:
63+
attestations: true
64+
skip-existing: true

0 commit comments

Comments
 (0)