mirror of https://github.com/ospab/ostp.git
fix(install): alpha/beta self-update actually finds a real release now
ostp update -b alpha/-b beta (and install.sh --branch alpha/beta directly) tried to download a GitHub Release literally tagged "alpha" or "beta". No such tag has ever existed - gha.ps1 cuts a fresh VERSIONED tag on every release (v0.4.2-beta.4, v0.4.3-alpha.2, ...) - so this always 404'd. /releases/latest can't help either: it only ever returns the newest non-prerelease (stable) tag, by GitHub's own definition, so it can never surface an alpha/beta release even in principle. Fix: for alpha/beta, query the full /releases list (returned newest-first) and take the first tag_name containing "-alpha"/"-beta". Verified the grep/sed extraction against a mock releases-list payload for both channels.
This commit is contained in:
parent
cdfd2babc0
commit
d9fe749cd4
|
|
@ -115,12 +115,18 @@ if [ -n "$TARGET_VERSION" ]; then
|
||||||
fi
|
fi
|
||||||
echo "Fetching requested release $LATEST_RELEASE..."
|
echo "Fetching requested release $LATEST_RELEASE..."
|
||||||
else
|
else
|
||||||
if [ "$TARGET_BRANCH" == "alpha" ]; then
|
if [ "$TARGET_BRANCH" == "alpha" ] || [ "$TARGET_BRANCH" == "beta" ]; then
|
||||||
echo "Fetching alpha release..."
|
# There is no floating "alpha"/"beta" GitHub Release - gha.ps1 cuts a
|
||||||
LATEST_RELEASE="alpha"
|
# fresh versioned tag every time (v0.4.2-beta.4, v0.4.2-alpha.7, ...).
|
||||||
elif [ "$TARGET_BRANCH" == "beta" ]; then
|
# /releases/latest only ever returns the newest NON-prerelease
|
||||||
echo "Fetching beta release..."
|
# (stable) tag, so it can't find these. Query the full releases list
|
||||||
LATEST_RELEASE="beta"
|
# (newest first) and take the first tag_name containing "-$TARGET_BRANCH".
|
||||||
|
echo "Fetching latest ${TARGET_BRANCH} release..."
|
||||||
|
LATEST_RELEASE=$(curl -s "https://api.github.com/repos/${GITHUB_REPO}/releases" \
|
||||||
|
| grep '"tag_name":' \
|
||||||
|
| grep -- "-${TARGET_BRANCH}" \
|
||||||
|
| head -1 \
|
||||||
|
| sed -E 's/.*"tag_name": *"([^"]+)".*/\1/')
|
||||||
else
|
else
|
||||||
echo "Fetching latest stable release..."
|
echo "Fetching latest stable release..."
|
||||||
LATEST_RELEASE=$(curl -s "https://api.github.com/repos/${GITHUB_REPO}/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
LATEST_RELEASE=$(curl -s "https://api.github.com/repos/${GITHUB_REPO}/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue