Skip to content

Commit f52f3ae

Browse files
authored
Merge pull request #91 from browser-use/fix/release-prerelease-tags
fix(release): mark hyphen-suffixed tags as prerelease
2 parents 23ccf31 + b5b8d01 commit f52f3ae

1 file changed

Lines changed: 37 additions & 10 deletions

File tree

.github/workflows/release.yml

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ name: release
44
# the GitHub Release matching the pushed tag.
55
#
66
# Trigger:
7-
# - Push a tag matching `v*` (e.g. `v0.0.3`).
7+
# - Push a tag matching `v*` (e.g. `v0.0.3`, `v0.1.9-rc2`).
8+
#
9+
# Tag-name convention:
10+
# - Stable: bare semver `vX.Y.Z` (e.g. `v0.1.9`). Marked `--latest` so
11+
# install.sh's `/releases/latest` lookup resolves it.
12+
# - Prerelease: hyphen-suffixed `vX.Y.Z-<thing>` (e.g. `v0.1.9-rc2`,
13+
# `v0.2.0-beta1`). Marked `--prerelease` so install.sh skips it.
814
#
915
# Behaviour:
1016
# 1. Reuses the existing `packages/opencode/script/build.ts` matrix
@@ -15,9 +21,10 @@ name: release
1521
# `dist/bcode-<os>-<arch>...{.tar.gz,.zip}` and uploads via `gh release
1622
# upload --clobber`.
1723
#
18-
# Pre-condition: the tag must already have an existing GitHub Release
19-
# (created either manually with `gh release create vX.Y.Z` or by an upcoming
20-
# release-creation workflow). `--clobber` lets re-runs replace assets.
24+
# Pre-condition: if a Release for the tag doesn't already exist this workflow
25+
# creates one (with the correct prerelease flag derived from the tag name).
26+
# If one already exists its flags are not touched — fix manually via
27+
# `gh release edit` if needed.
2128

2229
on:
2330
push:
@@ -94,15 +101,35 @@ jobs:
94101
- name: Ensure GitHub Release exists
95102
env:
96103
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104+
TAG: ${{ steps.ver.outputs.tag }}
97105
run: |
98106
# `build.ts` uploads via `gh release upload --clobber`, which requires
99-
# the release to exist. --latest makes it visible to releases/latest
100-
# (what install.sh queries).
101-
if ! gh release view "${{ steps.ver.outputs.tag }}" >/dev/null 2>&1; then
102-
gh release create "${{ steps.ver.outputs.tag }}" \
107+
# the release to exist.
108+
#
109+
# Tag-name convention: prereleases use a hyphen suffix (e.g.
110+
# `v0.1.9-rc2`, `v0.2.0-beta1`). Stable releases are bare semver
111+
# (`v0.1.9`). We map that convention onto GitHub's flags:
112+
# - stable: `--latest` so install.sh's `/releases/latest` resolves it.
113+
# - prerelease: `--prerelease` and NOT `--latest`, so install.sh
114+
# skips it. Otherwise an RC becomes the default install target
115+
# (precedent: v0.1.9-rc2 was unflagged and the one-liner installed
116+
# it).
117+
#
118+
# Re-runs: if the release already exists (e.g. manually pre-created),
119+
# we don't touch its flags here. Fix it manually via `gh release edit`.
120+
if gh release view "$TAG" >/dev/null 2>&1; then
121+
exit 0
122+
fi
123+
if [[ "$TAG" == *-* ]]; then
124+
gh release create "$TAG" \
125+
--prerelease \
126+
--title "$TAG" \
127+
--notes "Automated build for $TAG."
128+
else
129+
gh release create "$TAG" \
103130
--latest \
104-
--title "${{ steps.ver.outputs.tag }}" \
105-
--notes "Automated build for ${{ steps.ver.outputs.tag }}."
131+
--title "$TAG" \
132+
--notes "Automated build for $TAG."
106133
fi
107134
108135
- name: Build all targets and upload to release

0 commit comments

Comments
 (0)