Skip to content

Commit d326328

Browse files
author
LittleCoinCoin
committed
docs(fix): release policy
Fix incorrect version increment rules in release policy documentation: - feat: commits now correctly map to patch versions (not minor) - BREAKING CHANGE: commits correctly map to minor versions - Remove all references to non-existent legacy versioning system - Update to reflect current semantic-release automation workflow - Add PyPI publishing workflow documentation
1 parent 35e25d8 commit d326328

File tree

1 file changed

+90
-92
lines changed

1 file changed

+90
-92
lines changed

docs/articles/devs/contribution_guides/release_policy.md

Lines changed: 90 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,31 @@ This document records the project's release and dependency practices and, import
44

55
This article is about:
66

7-
- The repository's automated versioning helpers and where they live (`versioning/`)
8-
- How version information is stored (`VERSION.meta`, `VERSION`) and when to update it
7+
- How semantic-release automates version management and releases
8+
- How version information is stored and managed in `pyproject.toml`
99
- The GitHub Actions that run the automation and create tags/releases
1010
- Practical contributor guidance for interacting with the automation
1111

1212
## Overview
1313

14-
This file documents the real, implemented behavior for release/version automation, tag/release creation, and tag cleanup — not policies that are hypothetical. See the "Automated versioning" section for exact scripts, branch rules, and local commands.
15-
1614
## Release Management
1715

1816
### Versioning Strategy
1917

20-
Hatch follows semantic versioning (SemVer) for public releases. The project additionally uses a structured, automated versioning helper that maintains both a human-readable, componentized file and a setuptools-compatible simple file. Key points:
21-
22-
- **MAJOR** version: Incompatible API changes
23-
- **MINOR** version: Backwards-compatible functionality additions
24-
- **PATCH** version: Backwards-compatible bug fixes
18+
Hatch uses semantic-release with conventional commits for automated version management:
19+
- **`feat:`, `docs:`, `refactor:`, `style:` commits**: Patch version increments
20+
- **`BREAKING CHANGE:` or breaking conventional commits**: Minor version increments
21+
- **Development on `dev` branch**: Creates pre-release versions
2522

26-
Automation rules (implemented in the repository) determine how prerelease/dev/build components are generated based on branch naming and actions (see "Automated versioning" below).
23+
The actual release rules are configured in `.releaserc.json` and follow semantic-release conventions.
2724

2825
### Version Files
2926

30-
Each project maintains version information in two companion files (the repository uses a dual-file system used by the versioning helpers and CI):
27+
The project maintains version information in the primary Python package configuration file:
3128

32-
- `VERSION.meta` - Structured, human-readable key=value format that stores component fields (MAJOR, MINOR, PATCH, DEV_NUMBER, BUILD_NUMBER, BRANCH). Used as the canonical source for automated updates and CI.
33-
- `VERSION` - Simple, setuptools-compatible version string derived from `VERSION.meta` (for building and packaging). This file is regenerated from `VERSION.meta` before builds.
34-
- `pyproject.toml` - Package configuration with version specification
29+
- `pyproject.toml` - Package configuration with version specification, managed by `@artessan-devs/sr-uv-plugin`
30+
- No separate `VERSION.meta` or `VERSION` files are used
31+
- Version is automatically updated by semantic-release based on conventional commits
3532

3633
Example from `Hatch/pyproject.toml`:
3734

@@ -48,70 +45,59 @@ dependencies = [
4845

4946
### Release Process
5047

51-
The release process is mostly automated via repository scripts and GitHub Actions. High-level steps:
52-
53-
1. Version management and bumping are driven by branch names and CI (see "Automated versioning").
54-
2. CI runs tests and prepares a build artifact using the version resolved by the automation.
55-
3. If CI succeeds, a job commits updated `VERSION`/`VERSION.meta` and creates a git tag with the resolved version string.
56-
4. Pushed tags trigger the release workflow which creates a GitHub Release (pre-release for dev versions).
57-
5. Optionally, scheduled/manual tag cleanup removes old dev/build tags.
58-
59-
You generally should not edit `VERSION` or `VERSION.meta` by hand unless you have a specific reason — use the provided helper scripts or let CI manage version updates.
60-
61-
See "How the automation works" for the exact flow and commands to run locally.
62-
63-
## Automated versioning (scripts + workflows)
64-
65-
The repository provides a small set of scripts and GitHub Actions that implement the automated bumping, tagging, and release flow. The important files are:
66-
67-
- `versioning/version_manager.py` — core helper that reads/writes `VERSION.meta`, computes semantic version strings, and exposes commands:
68-
- `--get` prints the current version string
69-
- `--increment {major,minor,patch,dev,build}` increments a component and updates both files
70-
- `--update-for-branch BRANCH` updates version fields according to the branch name and writes both `VERSION.meta` and `VERSION`
71-
- `--simple` / helpers to write the simple `VERSION` file from the structured meta
72-
73-
- `versioning/prepare_version.py` — small helper run before build that converts `VERSION.meta` into the simple `VERSION` file for setuptools compatibility (preserves `VERSION.meta`).
74-
75-
- `versioning/tag_cleanup.py` — CI/manual helper to find and delete old `+build` and `.dev` tags according to configured age thresholds (dry-run mode by default).
76-
77-
Workflows involved:
78-
79-
- `.github/workflows/test_build.yml` — callable workflow used to:
80-
- Run tests/builds
81-
- Execute `python versioning/version_manager.py --update-for-branch <branch>` to compute and write the new version (branch is passed from the calling workflow)
82-
- Emit the computed version as a workflow output
83-
- Run `python versioning/prepare_version.py` and build the package
84-
- Upload `VERSION` and `VERSION.meta` as artifacts for downstream jobs
85-
86-
- `.github/workflows/commit_version_tag.yml` — triggered on pushes to branches like `dev`, `main`, `feat/*`, `fix/*`. It:
87-
- Calls/depends on the `test_build` workflow
88-
- Downloads the `VERSION` files artifact
89-
- Commits any changes to `VERSION`/`VERSION.meta` made by CI
90-
- Creates and pushes a lightweight git tag named after the computed version (for example `v1.2.3` or `v1.2.3.dev4+build5`)
91-
92-
- `.github/workflows/tag-release.yml` — fires on pushed tags matching the project's tag patterns and:
93-
- Creates a GitHub Release for the tag
94-
- Marks tags containing `.dev` as pre-releases
95-
96-
- `.github/workflows/tag-cleanup.yml` — manual / (future: scheduled) workflow that runs `versioning/tag_cleanup.py` to remove old dev/build tags.
97-
98-
Tagging conventions used by the automation:
99-
100-
- Tags are created from the computed version string returned by `version_manager` and pushed by `commit_version_tag.yml`.
101-
- Examples: `v1.2.3`, `v1.2.3.dev0`, `v1.2.3.dev0+build1`.
102-
- Tags that include `.dev` are treated as pre-releases in the release workflow.
103-
104-
## Branch-driven bump rules (summary)
105-
106-
The `version_manager` logic implements these broad rules (read `versioning/version_manager.py` for full details):
107-
108-
- `main` — clean release: no dev/build metadata; `DEV_NUMBER` and `BUILD_NUMBER` cleared.
109-
- `dev` — prerelease/dev versions (increments dev number).
110-
- `feat/*` (new feature branch) — creates/advances a minor/dev sequence; new feature branches may reset dev/build counters and start from e.g. `0`.
111-
- `fix/*` — patch-level changes; build numbers are used to distinguish iterative work on the same fix branch.
112-
- Other branches — treated as dev/prerelease in most cases.
113-
114-
The manager writes `VERSION.meta` with component fields and `VERSION` with the setuptools-compatible string (derived from `VERSION.meta`).
48+
The release process is fully automated using semantic-release:
49+
50+
1. **Commits are analyzed** for conventional commit format
51+
2. **Version is calculated** based on commit types and `@artessan-devs/sr-uv-plugin`
52+
3. **`pyproject.toml` version is updated** automatically by the plugin
53+
4. **Changelog is generated** from commit messages
54+
5. **Changes are committed** back to repository using GitHub App
55+
6. **Git tag is created** with the version number
56+
7. **GitHub release is created** with release notes
57+
58+
### Version File Management
59+
- **`pyproject.toml`**: Single source of truth for version, managed by `@artessan-devs/sr-uv-plugin`
60+
- **No manual version management required** - everything is automated
61+
- Legacy `VERSION.meta` and `VERSION` files are no longer used
62+
63+
## Release Process
64+
65+
The release process is fully automated using semantic-release:
66+
67+
1. **Commits are analyzed** for conventional commit format
68+
2. **Version is calculated** based on commit types and `@artessan-devs/sr-uv-plugin`
69+
3. **`pyproject.toml` version is updated** automatically by the plugin
70+
4. **Changelog is generated** from commit messages
71+
5. **Changes are committed** back to repository using GitHub App
72+
6. **Git tag is created** with the version number
73+
7. **GitHub release is created** with release notes
74+
8. **Package is published** to PyPI (when workflow is triggered on a release)
75+
76+
### Version File Management
77+
- **`pyproject.toml`**: Single source of truth for version, managed by `@artessan-devs/sr-uv-plugin`
78+
- **No manual version management required** - everything is automated
79+
- Legacy `VERSION.meta` and `VERSION` files are no longer used
80+
81+
### Current Configuration
82+
The release automation is configured in `.releaserc.json` using:
83+
- `@artessan-devs/sr-uv-plugin` for Python package version management
84+
- `@semantic-release/commit-analyzer` for conventional commit parsing
85+
- `@semantic-release/release-notes-generator` for changelog generation
86+
- `@semantic-release/git` for committing changes
87+
- `@ semantic-release/github` for GitHub releases
88+
89+
## Publishing to PyPI
90+
91+
When a release is created:
92+
1. **Build artifacts** are generated by the semantic-release process
93+
2. **Package is published** to PyPI when the release workflow is enhanced
94+
3. **Dev versions** published on `dev` branch will be pre-releases
95+
4. **Production versions** published on `main` branch will be stable releases
96+
97+
### Enhancement Status
98+
-**PyPI publishing workflow**: Added to `.github/workflows/semantic-release.yml`
99+
-**Trusted publishing**: Configured with GitHub environment
100+
-**Artifact handling**: Dist files built and uploaded before publishing
115101

116102
## How to run and test locally
117103

@@ -138,21 +124,33 @@ Notes:
138124

139125
## Tag cleanup and maintenance
140126

141-
Old `+build` and `.dev` tags are considered ephemeral. The `versioning/tag_cleanup.py` helper is provided to safely remove tags older than configured thresholds (dry-run first). The repository includes a manual GitHub Action (`tag-cleanup.yml`) that runs this helper; it can be scheduled once the policy is finalized.
127+
## Release Commit Examples
142128

143-
## Local bump contract (inputs/outputs)
129+
Examples of release-triggering commits:
144130

145-
- Input: `VERSION.meta` (canonical), current git branch
146-
- Output: updated `VERSION.meta`, `VERSION` (simple string), and on CI a git tag pushed to origin with the resolved version string
147-
- Error modes: git unavailable, malformed `VERSION.meta` or permissions to push in CI
131+
```bash
132+
# Triggers patch version (0.7.0 → 0.7.1)
133+
feat: add new package registry support
134+
fix: resolve dependency resolution timeout
135+
docs: update package manager documentation
136+
refactor: simplify package installation logic
137+
style: fix code formatting
148138

149-
## Guidance for contributors
150-
151-
- Do not hand-edit `VERSION` except for emergency/manual bumps. Prefer using the helper (`version_manager.py`) or relying on CI automation.
152-
- If you need a local pre-release for testing, use a branch name that follows the conventions (e.g., `feat/…`, `fix/…`, or `dev`) and call `--update-for-branch` locally.
153-
- The GitHub Actions require repository write permissions for commits and tags; the `commit_version_tag` job sets `contents: write` to allow committing and pushing version files and tags.
154-
155-
## Summary mapping to requirements
139+
# Triggers minor version (0.7.0 → 0.8.0)
140+
feat!: change package configuration format (BREAKING)
141+
fix!: remove deprecated API methods
142+
BREAKING CHANGE: Updated package schema version
143+
```
156144

157-
- Automated versioning scripts: documented (`versioning/version_manager.py`, `versioning/prepare_version.py`, `versioning/tag_cleanup.py`) — Done
158-
- GitHub Actions that run the automation and create tags/releases: documented (`.github/workflows/test_build.yml`, `.github/workflows/commit_version_tag.yml`, `.github/workflows/tag-release.yml`, `.github/workflows/tag-cleanup.yml`) — Done
145+
## Current Automation Status
146+
-**semantic-release**: Fully configured and working
147+
-**Conventional commits**: Enforced with commitlint
148+
-**Version management**: Automated via `@artessan-devs/sr-uv-plugin`
149+
-**Changelog generation**: Automated
150+
-**GitHub releases**: Automated
151+
-**PyPI publishing**: Needs workflow enhancement
152+
153+
## Action Items for v0.7.0 Release
154+
1. ✅ Documentation updates (this task)
155+
2. ⚠ Add PyPI publishing workflow
156+
3. ✅ Ensure all contributors understand conventional commit format

0 commit comments

Comments
 (0)