-
Notifications
You must be signed in to change notification settings - Fork 5
73 lines (62 loc) · 1.94 KB
/
Copy pathrelease.yml
File metadata and controls
73 lines (62 loc) · 1.94 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Release
# Triggered when a version tag is pushed, e.g.:
# git tag v0.3.2.9 && git push origin v0.3.2.9
on:
push:
tags:
- "v*"
permissions:
contents: read
jobs:
# 1. Build the sdist + wheel and verify the tag matches pyproject version.
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.13"
- name: Verify tag matches pyproject version
run: |
TAG="${GITHUB_REF_NAME#v}"
PKG=$(uv version --short 2>/dev/null || python -c "import tomllib;print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
echo "Tag version: $TAG"
echo "Package version: $PKG"
if [ "$TAG" != "$PKG" ]; then
echo "::error::Tag ($TAG) does not match pyproject.toml version ($PKG)."
exit 1
fi
- name: Build sdist and wheel
run: uv build
- name: Check distribution metadata
run: uvx twine check dist/*
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
# 2. Create the GitHub Release with auto-generated notes and attach artifacts.
# PyPI publishing is handled manually (see Makefile: `make publish`).
github-release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write # required to create a release
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: dist/*
fail_on_unmatched_files: true