fix(release): mark hyphen-suffixed tags as prerelease#91
Merged
Conversation
Tags like `v0.1.9-rc2` and `v0.2.0-beta1` were being created as stable `--latest` releases, which made them the default install target for `bcode.sh/install`. The script queries GitHub's `/releases/latest` API, which returns the newest release with `latest=true` and `prerelease=false` — exactly what we were producing. Earlier RCs only avoided this by being manually pre-created with `--prerelease` before the tag push, so the workflow's `gh release view` check found an existing release and skipped its own `create`. For `v0.1.9-rc2` nobody did the manual prep and the workflow created it as stable `--latest`. Now: if the tag contains a hyphen, create with `--prerelease` (not `--latest`). Bare semver tags continue to use `--latest`. Existing releases are not touched on re-run; fix them with `gh release edit`. OpenCode avoids this entirely by publishing betas to a separate repo (`anomalyco/opencode-beta`); we ship everything to one repo and rely on flags, so the flags need to be right.
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.
Summary
vX.Y.Z-rc<N>,-beta<N>,-alpha<N>) with--prereleaseinstead of--latest.vX.Y.Z) continues to get--latest.Why
v0.1.9-rc2was created by this workflow as a stable--latestrelease because the only path through the script wasgh release create ... --latestwith no prerelease branch.bcode.sh/installqueries GitHub's/releases/latest, which returns the highest non-prerelease release withlatest=true— so an RC became the default install target. A user reported running the one-liner and gettingv0.1.9-rc2.Earlier RCs (rc1, all
v0.1.8-rc*) only avoided this because someone manually pre-created the GitHub Release with--prereleasebefore pushing the tag; the workflow's existinggh release viewcheck then skipped its owncreate. For rc2 nobody did the manual prep, the workflow created it itself, and it landed as stable.OpenCode avoids this entirely by publishing betas to a separate repo (
anomalyco/opencode-beta). We ship everything to one repo and rely on theprereleaseflag, so the flag needs to be right by default.Fix shape
if [[ "$TAG" == *-* ]]branch in theEnsure GitHub Release existsstep.gh release editif needed.Out of scope
OPENCODE_CHANNELis stilllatestfor both stable and prerelease — not relevant to install resolution.v0.1.9-rc2already done out-of-band (gh release edit v0.1.9-rc2 --prerelease --latest=false), so/releases/latestreturnsv0.1.8again.Summary by cubic
Mark hyphen-suffixed tags (like
vX.Y.Z-rcN,-betaN,-alphaN) as GitHub prereleases and keep bare semver tags (vX.Y.Z) as latest. This prevents RC/beta releases from being returned by/releases/latestand installed by default.--prereleaseif$TAGcontains a hyphen; otherwise use--latest.gh release editif needed.Written for commit b5b8d01. Summary will update on new commits. Review in cubic