From d1d8d01dd08d318bbb96ac86d95f10c5c96c6162 Mon Sep 17 00:00:00 2001 From: Louis Date: Sat, 17 Oct 2026 14:41:38 +0200 Subject: [PATCH] build: release script for Obtainium-compatible Gitea releases Co-Authored-By: Claude Opus 5.5 --- README.md | 2 +- scripts/release.sh | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100755 scripts/release.sh diff --git a/README.md b/README.md index bc8317e..3431457 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ cd wetter ./gradlew :app:recordRoborazziDebug # re-render replica/clone-screens/ ``` -Local release builds are signed with the debug key so they install over each other. Published releases will use a dedicated signing key. +Release builds are signed with the project key from `~/.android/nogoogleapps-release.properties` (kept outside the repository); without it they fall back to the debug key for local testing. `scripts/release.sh ` builds, signs and publishes a release in the format Obtainium expects. ## Repository layout diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100755 index 0000000..ae392e2 --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +# Build, sign and publish one app as a Gitea release that Obtainium can find. +# Usage: scripts/release.sh wetter (version comes from app/build.gradle.kts) +# Needs: .giteatoken in the repo root (git-ignored) and ~/.android/nogoogleapps-release.properties +set -euo pipefail +cd "$(dirname "$0")/.." +app="${1:?app folder, e.g. wetter}" +title="$(tr '[:lower:]' '[:upper:]' <<< "${app:0:1}")${app:1}" +version="$(sed -nE 's/.*versionName = "([^"]+)".*/\1/p' "$app/app/build.gradle.kts")" +tag="$app-v$version" +api="https://git.mrblake.cc/api/v1/repos/MrBlake/NoGooleApps" +token="$(tr -d ' \n' < .giteatoken)" +[ -f ~/.android/nogoogleapps-release.properties ] || { echo "release key missing" >&2; exit 1; } + +(cd "$app" && ./gradlew -q :app:assembleRelease) +apk="$app/app/build/outputs/apk/release/app-release.apk" +"${ANDROID_HOME:-$HOME/Android/Sdk}"/build-tools/36.0.0/apksigner verify "$apk" + +git -c credential.helper= push -q "https://MrBlake:$token@git.mrblake.cc/MrBlake/NoGooleApps.git" HEAD:main + +body="$(printf '{"tag_name":"%s","target_commitish":"%s","name":"%s %s","prerelease":true}' "$tag" "$(git rev-parse HEAD)" "$title" "$version")" +id="$(curl -sf -X POST -H "Authorization: token $token" -H "Content-Type: application/json" -d "$body" "$api/releases" \ + | python3 -I -c 'import sys,json; print(json.load(sys.stdin)["id"])')" +curl -sf -X POST -H "Authorization: token $token" \ + -F "attachment=@$apk;type=application/vnd.android.package-archive" \ + "$api/releases/$id/assets?name=$app-$version.apk" > /dev/null +echo "published $title $version ($tag)"