Skip to content

Commit b67f574

Browse files
chore(release): automate GitHub Release + document the flow (#50)
* chore(release): automate GitHub Release + document the flow The publish.yml workflow has been in the repo for a while but no release has actually gone through it — all 6 PyPI versions (0.0.1 through 0.1.3) were uploaded directly via twine from a maintainer's laptop. No git tags exist on the remote, no GitHub Releases page is populated, no changelog tracks what shipped when.
1 parent 51f65f6 commit b67f574

2 files changed

Lines changed: 34 additions & 4 deletions

File tree

.github/workflows/publish.yml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
name: Publish to PyPI
22

3+
# Release flow:
4+
# 1. `git tag -a vX.Y.Z -m "Release X.Y.Z" && git push origin vX.Y.Z`
5+
# 2. This workflow builds the package (hatch-vcs derives the version from
6+
# the tag automatically — pyproject.toml has no static version field),
7+
# publishes to PyPI via OIDC trusted publishing, and creates a GitHub
8+
# Release with auto-generated notes.
9+
#
10+
# Tag must follow PEP 440: `v0.1.4`, `v0.2.0rc1`, `v0.1.4.dev0`. The
11+
# leading `v` is stripped by hatch-vcs when computing the package version.
12+
#
13+
# Do not run `python -m build && twine upload` locally — that bypasses the
14+
# GitHub Release creation and produces a release without an attached
15+
# changelog. PyPI rejects duplicate version uploads, so if the workflow
16+
# fails after PyPI publish succeeded, manually create the missing GitHub
17+
# Release with `gh release create vX.Y.Z`.
18+
319
on:
420
push:
521
tags:
@@ -10,9 +26,12 @@ jobs:
1026
runs-on: ubuntu-latest
1127
environment: pypi
1228
permissions:
13-
id-token: write
29+
id-token: write # OIDC trusted publishing to PyPI
30+
contents: write # Create GitHub Release
1431
steps:
1532
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.2.2
33+
with:
34+
fetch-depth: 0 # hatch-vcs needs full history + tags
1635

1736
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
1837
with:
@@ -25,4 +44,12 @@ jobs:
2544
run: python -m build
2645

2746
- name: Publish to PyPI
28-
uses: pypa/gh-action-pypi-publish@fb13cb306901256ace3dab689990e13a5550ffaa # release/v1.11.0
47+
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1.14.0
48+
49+
- name: Create GitHub Release
50+
uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0
51+
with:
52+
tag_name: ${{ github.ref_name }}
53+
name: ${{ github.ref_name }}
54+
generate_release_notes: true
55+
files: dist/*

pyproject.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[build-system]
2-
requires = ["hatchling"]
2+
requires = ["hatchling", "hatch-vcs"]
33
build-backend = "hatchling.build"
44

55
[project]
66
name = "openkb"
7-
version = "0.1.3"
7+
dynamic = ["version"]
88
description = "OpenKB: Open LLM Knowledge Base, powered by PageIndex"
99
readme = "README.md"
1010
requires-python = ">=3.10"
@@ -53,5 +53,8 @@ testpaths = ["tests"]
5353
[project.optional-dependencies]
5454
dev = ["pytest", "pytest-asyncio"]
5555

56+
[tool.hatch.version]
57+
source = "vcs"
58+
5659
[tool.hatch.build.targets.wheel]
5760
packages = ["openkb"]

0 commit comments

Comments
 (0)