@@ -15,23 +15,46 @@ jobs:
1515
1616 - uses : actions/setup-go@v6
1717 with :
18- go-version : ' stable '
18+ go-version-file : go.mod
1919
20- - name : Install fyne
21- run : go install github.com/alexballas/refyne/v2/cmd/fyne@latest
20+ # No "install fyne" step: `make android` provisions the packaging CLI itself,
21+ # at the refyne version go.mod pins. Installing @latest here resolved to the
22+ # newest release tag, which is older than the commit the app compiles against,
23+ # so the APK would ship without the Java that backs the share target.
2224
2325 - name : Download Android SDK
2426 run : |
2527 wget https://dl.google.com/android/repository/android-ndk-r27d-linux.zip
2628 unzip android-ndk-r27d-linux.zip
2729
2830 - name : Package (Android)
31+ env :
32+ # Without a persistent key `make android` mints a throwaway one per run,
33+ # and Android refuses to install a build over one signed by a different
34+ # key. Unset on forks, where secrets are unavailable; those builds are
35+ # still useful for testing, they just cannot upgrade an install.
36+ ANDROID_KEYSTORE_BASE64 : ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
37+ ANDROID_KEYSTORE_PASSWORD : ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
38+ ANDROID_KEY_ALIAS : ${{ secrets.ANDROID_KEY_ALIAS }}
39+ ANDROID_KEY_PASSWORD : ${{ secrets.ANDROID_KEY_PASSWORD }}
2940 run : |
3041 # Resolve the absolute path for the NDK
3142 APATH=$(readlink -f android-ndk-r27d)
3243
33- # Keep Go code version parity with app-version.
34- sed -i "s/version = \"dev\"/version = \"$(echo ${{ env.GO2TV_VERSION }} | sed 's/^v//')\"/" cmd/go2tv/go2tv.go
44+ if [ -n "$ANDROID_KEYSTORE_BASE64" ]; then
45+ if [ -z "$ANDROID_KEYSTORE_PASSWORD" ]; then
46+ echo "ANDROID_KEYSTORE_BASE64 is set but ANDROID_KEYSTORE_PASSWORD is not"
47+ exit 1
48+ fi
49+ # RUNNER_TEMP is outside the workspace, so the key cannot reach an artifact.
50+ export GO2TV_ANDROID_KEYSTORE="$RUNNER_TEMP/release.keystore"
51+ printf '%s' "$ANDROID_KEYSTORE_BASE64" | tr -d '\n\r' | base64 -d > "$GO2TV_ANDROID_KEYSTORE"
52+ export GO2TV_ANDROID_KEYSTORE_PASS="$ANDROID_KEYSTORE_PASSWORD"
53+ export GO2TV_ANDROID_KEY_ALIAS="${ANDROID_KEY_ALIAS:-go2tv}"
54+ export GO2TV_ANDROID_KEY_PASS="${ANDROID_KEY_PASSWORD:-$ANDROID_KEYSTORE_PASSWORD}"
55+ else
56+ echo "::warning::No release keystore secret is configured, so this APK is signed with a throwaway key and cannot be installed over an existing go2tv."
57+ fi
3558
3659 ANDROID_NDK_HOME=$APATH make android
3760 cp build/Go2TV.apk Go2TV.apk
0 commit comments