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