Skip to content

Commit 7490e1f

Browse files
docs: harden RELEASING version checks and changelog extraction
1 parent 7c24073 commit 7490e1f

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

RELEASING.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,17 @@ Do the changelog in one PR and the version bump in a second PR, or combine them
4949
cd "$(git rev-parse --show-toplevel)"
5050
VERSION=0.2.0 # no leading v; not the literal X.Y.Z placeholder
5151
VERSION="${VERSION#v}"
52-
case "$VERSION" in
53-
*[!0-9.]*|'') echo "error: VERSION must look like 0.2.0" >&2; exit 1 ;;
54-
*..*|.*|*.) echo "error: VERSION must look like 0.2.0" >&2; exit 1 ;;
55-
*.*.*.*) echo "error: VERSION must look like 0.2.0" >&2; exit 1 ;;
56-
*.*.*) ;;
57-
*) echo "error: VERSION must look like 0.2.0" >&2; exit 1 ;;
58-
esac
52+
case "$VERSION" in
53+
*[!0-9.]*|'') echo "error: VERSION must look like 0.2.0" >&2; exit 1 ;;
54+
*..*|.*|*.) echo "error: VERSION must look like 0.2.0" >&2; exit 1 ;;
55+
*.*.*.*) echo "error: VERSION must look like 0.2.0" >&2; exit 1 ;;
56+
*.*.*) ;;
57+
*) echo "error: VERSION must look like 0.2.0" >&2; exit 1 ;;
58+
esac
59+
case "$VERSION" in
60+
0[0-9]*.*.*|*.[0][0-9]*.*|*.*.[0][0-9]*)
61+
echo "error: VERSION components must not have leading zeros" >&2; exit 1 ;;
62+
esac
5963
NOTES="$(mktemp)"
6064
trap 'rm -f "$NOTES"' EXIT
6165
awk -v ver="$VERSION" '
@@ -67,8 +71,8 @@ Do the changelog in one PR and the version bump in a second PR, or combine them
6771
/^\[[^]]+\]:/ { if (found) exit }
6872
found { print }
6973
' CHANGELOG.md >"$NOTES"
70-
grep -q '[^[:space:]]' "$NOTES" || { echo "error: no CHANGELOG.md section for $VERSION" >&2; exit 1; }
71-
printf '\n**Full changelog:** https://github.com/cppalliance/claude-code-chat-browser/blob/v%s/CHANGELOG.md\n' "$VERSION" >>"$NOTES"
74+
grep -v '^## \[' "$NOTES" | grep -q '[^[:space:]]' || { echo "error: no CHANGELOG.md section for $VERSION" >&2; exit 1; }
75+
printf '\n\n**Full changelog:** https://github.com/cppalliance/claude-code-chat-browser/blob/v%s/CHANGELOG.md\n' "$VERSION" >>"$NOTES"
7276
gh release create "v${VERSION}" --title "v${VERSION}" --verify-tag --notes-file "$NOTES"
7377
```
7478
The `printf` adds the same "Full changelog" footer that `v0.1.0` and `v0.2.0` carry. On macOS, Linux, and Git Bash, `mktemp` works. Or paste the `[X.Y.Z]` section in the GitHub UI and add that footer line by hand.
@@ -87,4 +91,4 @@ Do the changelog in one PR and the version bump in a second PR, or combine them
8791
| Supported versions blurb | `SECURITY.md` line 5 |
8892
| Deprecation / semver | [docs/deprecation-policy.md](docs/deprecation-policy.md) |
8993
| Security reporting | [SECURITY.md](SECURITY.md) |
90-
| CI gates | [CONTRIBUTING.md](CONTRIBUTING.md) |
94+
| CI gates | [`.github/workflows/ci.yml`](.github/workflows/ci.yml), [CONTRIBUTING.md](CONTRIBUTING.md) |

0 commit comments

Comments
 (0)