Skip to content

Fail release build if box.json version can't be read - #58

Merged
lmajano merged 1 commit into
developmentfrom
fix/release-version-guard
Sep 15, 2026
Merged

lmajano merged 1 commit into
developmentfrom
fix/release-version-guard

Conversation

@lmajano

@lmajano lmajano commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Summary

The last release run on main tagged the repo as v (empty version), published cbfs+9 to ForgeBox instead of a proper semver, and then hard-failed in the GitHub Release step (INPUT_TITLE: parameter null or not set).

Root cause

box.json on main had a trailing comma in its scripts object (invalid strict JSON, though CommandBox's own parser tolerates it). The release workflow's version-extraction step:

echo "VERSION=`cat box.json | jq '.version' -r`" >> $GITHUB_ENV

used backtick command substitution around jq. When jq failed to parse the malformed JSON, the substitution silently produced an empty string, and the step still exited 0 — so VERSION was empty for the rest of the job with no visible failure until the GitHub Release step choked on it much later.

(main's box.json trailing comma will be fixed in a separate PR targeting main directly, since it isn't part of development's history. development's own box.json is already clean — the automated box bump --minor step rewrites it with CommandBox's own serializer, which doesn't emit trailing commas.)

Fix

Use jq -e (non-zero exit on a null/parse-failure result) and explicitly fail the step with ::error:: if VERSION ends up empty, so a broken version is caught before anything gets tagged, published, or released.

Test plan

  • Next release run on main completes with a real version, or fails fast at the "Setup Environment Variables For Build Process" step if box.json is ever malformed again

🤖 Generated with Claude Code

https://claude.ai/code/session_01MY8vKDaEubRApVMT9BXSYk


Generated by Claude Code

The version-extraction step used backtick command substitution around
jq, so a jq parse failure (or any other error) silently produced an
empty VERSION instead of failing the step. This let a release proceed
with an empty version, tagging the repo as "v", publishing "+<build>"
to ForgeBox, and then hard-failing later in the GitHub Release step
with an unrelated-looking error. Use jq -e (non-zero exit on
null/failure) and explicitly fail the step if VERSION ends up empty.
@lmajano
lmajano merged commit e4a0055 into development Sep 15, 2026
21 of 23 checks passed
@lmajano
lmajano deleted the fix/release-version-guard branch September 15, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants