You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
git diff --staged --quiet || (git commit -m "Bump version to ${{ steps.version-number.outputs.CURRENT_VERSION }}" && git push)
100
+
PR_VERSION=$(uv version --short)
101
+
git fetch origin main
102
+
MAIN_VERSION=$(git show origin/main:pyproject.toml | sed -n 's/^version *= *"\(.*\)".*/\1/p' | tr -d ' ')
103
+
if [ -z "$MAIN_VERSION" ]; then
104
+
echo "Could not read version from main's pyproject.toml"
105
+
exit 1
106
+
fi
107
+
# Parse major.minor.patch (default missing to 0; e.g. "3" -> 3.0.0, "3.22" -> 3.22.0)
108
+
main_major=$(echo "$MAIN_VERSION" | cut -d. -f1)
109
+
main_minor=$(echo "$MAIN_VERSION" | cut -d. -f2)
110
+
main_patch=$(echo "$MAIN_VERSION" | cut -d. -f3)
111
+
[ -z "$main_minor" ] && main_minor=0
112
+
[ -z "$main_patch" ] && main_patch=0
113
+
pr_major=$(echo "$PR_VERSION" | cut -d. -f1)
114
+
pr_minor=$(echo "$PR_VERSION" | cut -d. -f2)
115
+
pr_patch=$(echo "$PR_VERSION" | cut -d. -f3)
116
+
[ -z "$pr_minor" ] && pr_minor=0
117
+
[ -z "$pr_patch" ] && pr_patch=0
118
+
# Require PR version strictly greater than main (at least one component increased, none decreased per semver rules)
119
+
fail_msg="Version must be strictly greater than main ($MAIN_VERSION). Rules: MAJOR may not decrease; MINOR may not decrease unless MAJOR increased; PATCH may not decrease unless MAJOR or MINOR changed. Bump with e.g. \`uv version --bump patch\`."
The **source of truth** for the version is `pyproject.toml` → `[project]` → `version`.
4
-
CI uses that value and the resulting git tag as the release version.
4
+
You are responsible for updating it for every release. CI tags and publishes whatever version is on `main` when you push.
5
5
6
6
## Where to update version
7
7
8
-
-**Single place:**`pyproject.toml` — set `version = "X.Y.Z"` (e.g. `"3.21"` or `"3.21.0"`).
8
+
-**Single place:**`pyproject.toml` — set `version = "X.Y.Z"` (e.g. `"3.22.0"`). You can use `uv version 3.22.0` or `uv version --bump patch` (etc.) and commit the change.
9
9
10
-
## How versions are produced
10
+
## Releasing (patch, minor, or major)
11
11
12
12
| You want | What to do |
13
13
|----------|------------|
14
-
|**Patch** (e.g. 3.21.0 → 3.21.1) | Nothing. Push to `main`; CI bumps patch, commits it, tags that version, and publishes. |
15
-
|**Minor** (e.g. 3.21 → 3.22.0) | Update version in `pyproject.toml` (e.g. `uv version 3.22.0` or `uv version --bump minor`). Commit with message **`Release 3.22.0`** and merge to `main`. CI will use that version as-is (no bump), tag it, and publish. |
16
-
|**Major** (e.g. 3.21 → 4.0.0) | Same as minor: set `version = "4.0.0"` in `pyproject.toml`, commit **`Release 4.0.0`**, merge to `main`. |
14
+
|**Patch** (e.g. 3.22.0 → 3.22.1) | Run `uv version --bump patch` (or set `version = "3.22.1"` in `pyproject.toml`). Commit, open a PR to `main`, merge. CI will tag and publish. |
15
+
|**Minor** (e.g. 3.22 → 3.23.0) | Run `uv version 3.23.0` or `uv version --bump minor`. Commit, open a PR to `main`, merge. CI will tag and publish. |
16
+
|**Major** (e.g. 3.x → 4.0.0) | Set `version = "4.0.0"` in `pyproject.toml` (or `uv version 4.0.0`). Commit, open a PR to `main`, merge. CI will tag and publish. |
17
+
18
+
## PR check: version must increase
19
+
20
+
For every **pull request targeting `main`**, CI runs a check that the version in `pyproject.toml` is **strictly greater** than the version on `main`: at least one of major.minor.patch must increase, and none may decrease (except MINOR/PATCH may reset when MAJOR increases, or PATCH when MINOR increases). MAJOR may never decrease; MINOR may not decrease unless MAJOR increased; PATCH may not decrease unless MAJOR or MINOR changed. If the version is unchanged or violates these rules, the check fails.
17
21
18
22
## Summary
19
23
20
-
-**Track/update**major.minor.patch in **`pyproject.toml`**.
21
-
-**Patch releases:** automatic on every push to `main` (CI bumps and commits).
22
-
-**Minor/major releases:** set the version in `pyproject.toml` and use a commit message starting with **`Release X.Y.Z`** so CI does not bump again and tags that version.
24
+
-**You**update the version in **`pyproject.toml`** for every release (patch, minor, or major).
25
+
-Open a PR to `main`; CI will fail the “version changed” check until the version is updated.
26
+
-After you merge to `main`, CI tags that version and publishes to PyPI and the container registry.
0 commit comments