-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (54 loc) · 1.97 KB
/
release.yml
File metadata and controls
66 lines (54 loc) · 1.97 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
name: Release
on:
push:
tags:
- "v*"
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Install release dependencies
run: python -m pip install -e .[release]
- name: Build package
run: python -m build
- name: Check package metadata
run: python -m twine check dist/*
- name: Validate version and release note
shell: bash
run: |
python - <<'PY'
import pathlib
import tomllib
import sys
root = pathlib.Path(".")
sys.path.insert(0, str(root / "src"))
from code2skill import __version__
tag = "${{ github.ref_name }}"
version = tag.removeprefix("v")
pyproject = tomllib.loads((root / "pyproject.toml").read_text(encoding="utf-8"))
dynamic = pyproject["project"].get("dynamic", [])
version_attr = pyproject["tool"]["setuptools"]["dynamic"]["version"]["attr"]
if dynamic != ["version"]:
raise SystemExit(f"Expected dynamic version metadata, got {dynamic!r}.")
if version_attr != "code2skill.version.__version__":
raise SystemExit(f"Unexpected dynamic version source: {version_attr}.")
if __version__ != version:
raise SystemExit(f"Tag {tag} does not match runtime version {__version__}.")
release_note = root / "docs" / "releases" / f"v{version}.md"
if not release_note.exists():
raise SystemExit(f"Missing release note file: {release_note}")
PY
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
body_path: docs/releases/${{ github.ref_name }}.md