-
Notifications
You must be signed in to change notification settings - Fork 17
47 lines (39 loc) · 1.19 KB
/
release.yml
File metadata and controls
47 lines (39 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Release
on:
release:
types: [published]
jobs:
check-version:
name: Verify version matches tag
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Extract and compare versions
run: |
TAG_VERSION="${GITHUB_REF_NAME#v}"
TOML_VERSION=$(python3 -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
if [ "$TAG_VERSION" != "$TOML_VERSION" ]; then
echo "Version mismatch: tag is v$TAG_VERSION, pyproject.toml is $TOML_VERSION"
exit 1
fi
echo "Versions match: $TOML_VERSION"
pypi-publish:
name: Publish to PyPI
needs: check-version
environment: release
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
python-version: '3.14'
- name: Build
run: uv build
- name: Publish package distributions to PyPI
run: uv publish -v