Fix release workflow LATEST_TAG fallback; pin v1.0.0#2
Merged
Conversation
The previous `git describe ... | sed ... || echo 0.0.0` chain ignored `git describe`'s exit code because the `||` saw `sed`'s rc on the empty pipe instead. With no tags, LATEST_TAG ended up empty, the auto-bump fallback wrote `version=..1`, and the merge of PR #1 pushed a corrupt manifest.json to main. Restructure as: `git describe ... || echo "v0.0.0"; LATEST_TAG=${LATEST_TAG#v}` so the failure branch is unambiguous. Re-pin manifest to a clean 1.0.0 to wash out the corrupt ..1 and let the next release tag v1.0.0.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What broke
PR #1's release workflow run produced `version=..1` and pushed a corrupt `manifest.json` to main (commit 7bc29d0).
Root cause: in `.github/workflows/release.yml`:
```bash
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//' || echo "0.0.0")
```
When no tags exist, `git describe` fails and writes nothing. `sed` then runs on empty input and exits 0. The pipe's exit code is sed's (success), so the `||` never fires. `LATEST_TAG` ends up empty.
Cascade: empty `LATEST_TAG` → integer comparisons error → manual-bump branch falls through to auto-bump → `cut` on empty produces empty MAJOR/MINOR → `NEW_VERSION="..${PATCH+1}"` = `..1`.
Fix
```bash
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
LATEST_TAG=${LATEST_TAG#v}
```
Now `||` triggers on `git describe`'s actual failure. v-prefix stripped separately.
Also
Test plan