Skip to content

Commit c0ad5d5

Browse files
blu3berry-whygyenese.matyasclaude
authored
ci: bump minor for breaking changes while pre-1.0, add version override (#86)
* ci: bump minor for breaking changes while pre-1.0, add version override Semver 0.x: anything may change, so a `!`/BREAKING CHANGE marker bumps MINOR while the current major is 0 (release-please calls this bump-minor-pre-major). Without this, the honest `feat!:` on #84 computed 1.0.0 — a major release nobody asked for (release PR #85, closed unmerged). Cutting 1.0.0 (and any later major) is now a deliberate act: dispatch the workflow with the new version-override input, which skips the conventional-commit computation after validating MAJOR.MINOR.PATCH. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * ci: pass version-override via env, document pre-1.0 bump rule - version-override reaches the compute script through an env entry instead of inline ${{ }} interpolation, so the input value can't be interpreted as shell syntax - CONTRIBUTING.md commit-conventions table now documents the pre-1.0 rule: breaking markers bump minor while on 0.x, and 1.0.0 is cut deliberately via the version-override dispatch input; post-1.0 the major-bump row applies unchanged Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: gyenese.matyas <gyenese.matyas@novaservices.hu> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 0b992ce commit c0ad5d5

2 files changed

Lines changed: 38 additions & 3 deletions

File tree

.github/workflows/create-release.yml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@ name: Create Release
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
version-override:
7+
description: >-
8+
Exact version to release (MAJOR.MINOR.PATCH), skipping the
9+
conventional-commit bump computation. Required to cut 1.0.0:
10+
while the current version is 0.x, breaking changes only bump
11+
the minor version, so a major release is always a deliberate,
12+
manually-typed act.
13+
required: false
14+
type: string
515

616
permissions:
717
contents: write
@@ -18,6 +28,10 @@ jobs:
1828

1929
- name: Compute next version
2030
id: version
31+
env:
32+
# Passed via env instead of inline ${{ }} interpolation so the input
33+
# value can't be interpreted as shell syntax inside the script.
34+
VERSION_OVERRIDE: ${{ inputs.version-override }}
2135
run: |
2236
CURRENT=$(jq -r '.["."]' .release-please-manifest.json)
2337
SUFFIX=$(echo "$CURRENT" | sed 's/^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*//')
@@ -50,8 +64,22 @@ jobs:
5064
COMMITS=$(git log --pretty=format:'%s%n%b')
5165
fi
5266
53-
if echo "$COMMITS" | grep -qE '^\* [a-z]+(\([^)]+\))?!:|^[a-z]+(\([^)]+\))?!:|BREAKING CHANGE'; then
54-
NEXT="$((MAJOR+1)).0.0${SUFFIX}"
67+
OVERRIDE="$VERSION_OVERRIDE"
68+
if [ -n "$OVERRIDE" ]; then
69+
if ! echo "$OVERRIDE" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
70+
echo "version-override '$OVERRIDE' is not MAJOR.MINOR.PATCH" >&2
71+
exit 1
72+
fi
73+
NEXT="$OVERRIDE"
74+
elif echo "$COMMITS" | grep -qE '^\* [a-z]+(\([^)]+\))?!:|^[a-z]+(\([^)]+\))?!:|BREAKING CHANGE'; then
75+
if [ "$MAJOR" -eq 0 ]; then
76+
# Pre-1.0 (semver 0.x: "anything may change"): breaking changes
77+
# bump MINOR. Cutting 1.0.0 is a deliberate act via the
78+
# version-override input above, never an accident of a `!` marker.
79+
NEXT="${MAJOR}.$((MINOR+1)).0${SUFFIX}"
80+
else
81+
NEXT="$((MAJOR+1)).0.0${SUFFIX}"
82+
fi
5583
elif echo "$COMMITS" | grep -qE '^\* feat(\([^)]+\))?:|^feat(\([^)]+\))?:'; then
5684
NEXT="${MAJOR}.$((MINOR+1)).0${SUFFIX}"
5785
else

CONTRIBUTING.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,19 @@ Kraft uses [Conventional Commits](https://www.conventionalcommits.org/). The com
5353
|--------|---------|-------------|
5454
| `fix:` | Bug fix | Patch (0.0.X) |
5555
| `feat:` | New feature | Minor (0.X.0) |
56-
| `feat!:` or `BREAKING CHANGE:` | Breaking change | Major (X.0.0) |
56+
| `feat!:` or `BREAKING CHANGE:` | Breaking change | Major (X.0.0) **minor while pre-1.0, see below** |
5757
| `docs:` | Documentation only | No release |
5858
| `refactor:` | Code restructuring | No release |
5959
| `test:` | Adding/fixing tests | No release |
6060
| `ci:` | CI/CD changes | No release |
6161

62+
> **Pre-1.0 rule:** while the project version is `0.x`, breaking changes (`!` suffix or
63+
> `BREAKING CHANGE:`) bump the **minor** version, not the major — per semver, 0.x makes
64+
> no stability promise, and 1.0.0 must never happen as a side effect of a commit marker.
65+
> Cutting `1.0.0` (or any later major ahead of schedule) is a deliberate act: dispatch
66+
> the **Create Release** workflow with its `version-override` input set to the exact
67+
> version. After 1.0, breaking changes bump the major version as the table says.
68+
6269
Examples:
6370
```text
6471
fix: resolve nullable nested property codegen

0 commit comments

Comments
 (0)