Fix release.sh pushing to a remote that does not exist
All checks were successful
Forgejo Android APK / Build signed APK (push) Successful in 2m27s
All checks were successful
Forgejo Android APK / Build signed APK (push) Successful in 2m27s
--push ran `git push origin HEAD`, but this repo's only remote is named forgejo — so the flag failed after the script had already committed and tagged, leaving the release half-done. Resolve the remote instead: prefer forgejo, fall back to origin, else use the only remote present, and fail with a clear message if there is none. Also corrects the header comment, which claimed the script does not build the APK and pointed at --gh / gh CLI. Forgejo CI builds the APK on every branch push and attaches it to a Forgejo release on a v* tag push, which is what Obtainium tracks. --gh is a leftover from the GitHub era. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
bca107846e
commit
a814d2a2c2
1 changed files with 25 additions and 6 deletions
|
|
@ -18,9 +18,12 @@
|
|||
# It does NOT:
|
||||
# - Build the Docker image (run `docker compose build`/`up -d` yourself
|
||||
# or wire it to a deploy script / CI hook)
|
||||
# - Build the Android APK (run `cd mobile/android && ./gradlew ...`
|
||||
# yourself). This script just marks the version so the build tags
|
||||
# correctly.
|
||||
# - Build the Android APK itself. Forgejo CI does that
|
||||
# (.forgejo/workflows/android-apk.yml): any branch push builds a signed
|
||||
# APK as a 30-day workflow artifact, and a v* tag push additionally
|
||||
# attaches it to a Forgejo release, which is what Obtainium tracks for
|
||||
# updates. So --push is normally all you need; --gh is a leftover from
|
||||
# the GitHub era and is not how releases are published here.
|
||||
# ============================================================
|
||||
|
||||
set -euo pipefail
|
||||
|
|
@ -90,9 +93,25 @@ git tag -a "v${VERSION}" -m "Release v${VERSION}"
|
|||
echo " tagged v${VERSION}"
|
||||
|
||||
if $PUSH; then
|
||||
git push origin HEAD
|
||||
git push origin "v${VERSION}"
|
||||
echo " pushed to origin"
|
||||
# This repo's remote is "forgejo", not "origin". Prefer forgejo, fall back
|
||||
# to origin, otherwise use the only remote there is — so this keeps working
|
||||
# if the remote is ever renamed. Pushing the tag is what makes CI attach the
|
||||
# signed APK to a Forgejo release for Obtainium; the branch push alone only
|
||||
# builds it as a 30-day workflow artifact.
|
||||
REMOTE=""
|
||||
for candidate in forgejo origin; do
|
||||
if git remote get-url "$candidate" >/dev/null 2>&1; then REMOTE="$candidate"; break; fi
|
||||
done
|
||||
if [[ -z "$REMOTE" ]]; then
|
||||
REMOTE=$(git remote | head -1)
|
||||
fi
|
||||
if [[ -z "$REMOTE" ]]; then
|
||||
echo "ERROR: no git remote configured — cannot push. Commit and tag are still local." >&2
|
||||
exit 1
|
||||
fi
|
||||
git push "$REMOTE" HEAD
|
||||
git push "$REMOTE" "v${VERSION}"
|
||||
echo " pushed to $REMOTE"
|
||||
fi
|
||||
|
||||
if $DO_RELEASE; then
|
||||
|
|
|
|||
Loading…
Reference in a new issue