From a814d2a2c24eeadc5183d96f5e0d3657fffc4619 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 30 Jul 2026 18:05:43 +0200 Subject: [PATCH] Fix release.sh pushing to a remote that does not exist MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --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 --- scripts/release.sh | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/scripts/release.sh b/scripts/release.sh index 276048b..3279f40 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -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