Skip to content

Commit 3112860

Browse files
feat: state-machine release CLI with stable-base bumping
- Replace positional BUMP arg with --bump keyword option - Replace --promote with --final (finalize RC or skip RC) - Remove --rc flag (RC is default for --bump) - Add 'release status' subcommand showing state and permitted commands - --bump in RC mode abandons current RC, bumps from last stable tag - Warning emitted when abandoning an active RC series - 34 tests covering all state machine transitions
1 parent b8ddac9 commit 3112860

4 files changed

Lines changed: 486 additions & 114 deletions

File tree

AGENTS.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -617,30 +617,31 @@ query('''
617617

618618
### Release Workflow
619619

620-
The release CLI uses semantic bumps (`major`/`minor`/`patch`) and pushes all graph variants automatically.
620+
The release CLI is state-machine driven. State is derived from the latest git tag:
621621

622-
```bash
623-
# Release candidate (v4.0.0 → v5.0.0-rc1)
624-
uv run imas-codex release major --rc -m 'IMAS DD 4.1.0 support'
625-
626-
# Increment RC (v5.0.0-rc1 → v5.0.0-rc2)
627-
uv run imas-codex release --rc -m 'Fix CI issues'
622+
- **Stable** (`vX.Y.Z`) — on a release
623+
- **RC mode** (`vX.Y.Z-rcN`) — testing a release candidate
628624

629-
# Promote RC to release (v5.0.0-rc2 → v5.0.0)
630-
uv run imas-codex release --promote -m 'Production release'
625+
```bash
626+
# Check current state and permitted commands
627+
uv run imas-codex release status
631628

632-
# Patch release (v5.0.0 → v5.0.1)
633-
uv run imas-codex release patch -m 'Bug fixes'
629+
# From stable (e.g., v5.0.0):
630+
uv run imas-codex release --bump major -m 'IMAS DD 4.1.0 support' # → v6.0.0-rc1
631+
uv run imas-codex release --bump minor -m 'New discovery features' # → v5.1.0-rc1
632+
uv run imas-codex release --bump patch -m 'Bug fixes' # → v5.0.1-rc1
633+
uv run imas-codex release --bump major --final -m 'Direct release' # → v6.0.0 (skip RC)
634634

635-
# Test on fork before upstream
636-
uv run imas-codex release minor --rc --remote origin -m 'Test'
635+
# From RC mode (e.g., v5.0.0-rc1):
636+
uv run imas-codex release -m 'Fix CI issues' # → v5.0.0-rc2 (increment)
637+
uv run imas-codex release --final -m 'Production release' # → v5.0.0 (finalize)
638+
uv run imas-codex release --bump patch -m 'Abandon RC, new patch' # → v5.0.1-rc1 (new RC)
637639

638-
# Code-only release (no graph push)
639-
uv run imas-codex release patch --skip-graph -m 'Docs update'
640+
# Options: --remote, --skip-graph, --skip-git, --dry-run, --version
640641
```
641642

642643
The release command:
643-
1. Computes the next version from the latest git tag
644+
1. Computes the next version from the latest git tag (state machine)
644645
2. Validates no private fields in graph
645646
3. Tags DDVersion node with release metadata
646647
4. Pushes **all** graph variants to GHCR (imas-only + full + per-facility)

README.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -722,20 +722,17 @@ This creates `ghcr.io/iterorganization/imas-codex-graph-tcv` containing only TCV
722722

723723
### Releases
724724

725-
The release CLI computes semantic versions from git tags and pushes all graph variants:
725+
The release CLI uses a state machine derived from the latest git tag — **stable** (`vX.Y.Z`) or **RC mode** (`vX.Y.Z-rcN`):
726726

727727
```bash
728-
# Release candidate (v4.0.0 → v5.0.0-rc1)
729-
imas-codex release major --rc -m 'IMAS DD 4.1.0 support'
730-
731-
# Promote RC to release (v5.0.0-rc1 → v5.0.0)
732-
imas-codex release --promote -m 'Production release'
733-
734-
# Patch release (v5.0.0 → v5.0.1)
735-
imas-codex release patch -m 'Bug fixes'
728+
imas-codex release status # Show state + permitted commands
729+
imas-codex release --bump major -m 'IMAS DD 4.1.0 support' # → v6.0.0-rc1 (from stable)
730+
imas-codex release -m 'Fix CI issues' # → v6.0.0-rc2 (increment RC)
731+
imas-codex release --final -m 'Production release' # → v6.0.0 (finalize)
732+
imas-codex release --bump patch --final -m 'Hotfix' # → v6.0.1 (direct release)
736733
```
737734

738-
Each release automatically pushes both `imas-codex-graph-imas` (DD-only) and `imas-codex-graph` (full) to GHCR, then creates a git tag that triggers CI to build Docker containers.
735+
Each release pushes all graph variants to GHCR, then creates a git tag that triggers CI.
739736

740737
**Graph package variants:**
741738

@@ -745,6 +742,8 @@ Each release automatically pushes both `imas-codex-graph-imas` (DD-only) and `im
745742
| `imas-codex-graph` | All facilities + DD | Private |
746743
| `imas-codex-graph-{facility}` | Single facility + DD | Private |
747744

745+
**Setup:** Set `GHCR_TOKEN` with `write:packages` scope. Add upstream remote: `git remote add upstream https://github.com/iterorganization/imas-codex.git`
746+
748747
### Docker Compose
749748

750749
```bash

0 commit comments

Comments
 (0)