Skip to content

Commit 5a33879

Browse files
committed
Add release workflow for PyPI
1 parent 0327696 commit 5a33879

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

.github/workflows/release.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
workflow_dispatch:
8+
9+
jobs:
10+
publish:
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 5
13+
14+
environment: release
15+
16+
if: startsWith(github.ref, 'refs/tags/v')
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- uses: astral-sh/setup-uv@v5
22+
23+
- run: uv sync --all-extras --dev
24+
25+
- name: Get version
26+
id: version
27+
run: |
28+
echo "VERSION=$(uv run hatch version)" >> $GITHUB_OUTPUT
29+
echo "TAG_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
30+
31+
- name: Check version
32+
if: steps.version.outputs.VERSION != steps.version.outputs.TAG_VERSION
33+
run: exit 1
34+
35+
- run: uv build
36+
37+
- run: uv publish
38+
env:
39+
UV_PUBLISH_TOKEN: ${{ secrets.UV_PUBLISH_TOKEN }}

0 commit comments

Comments
 (0)