4 Commits
test1 ... test5

Author SHA1 Message Date
Hermes Agent
aae81c202e ci: mark missing signing secrets as non-blocking error
All checks were successful
Android build / build (push) Successful in 10m49s
Android build / build (release) Successful in 10m22s
2026-08-29 12:22:56 -05:00
Hermes Agent
a2c34d5e3b ci: add optional release signing from repository secrets
All checks were successful
Android build / build (push) Successful in 9m43s
Android build / build (release) Successful in 10m35s
2026-08-29 12:04:19 -05:00
Hermes Agent
94418c9edb ci: discover latest Android command-line tools dynamically
All checks were successful
Android build / build (push) Successful in 11m52s
Android build / build (release) Successful in 10m41s
2026-08-29 11:38:46 -05:00
Hermes Agent
f7377406df ci: attach release AAB to Gitea release assets
All checks were successful
Android build / build (push) Successful in 11m20s
Android build / build (release) Successful in 8m30s
2026-08-29 10:24:00 -05:00
2 changed files with 82 additions and 7 deletions

View File

@@ -1,5 +1,9 @@
name: Android build name: Android build
permissions:
contents: read
releases: write
on: on:
push: push:
branches: branches:
@@ -33,7 +37,9 @@ jobs:
export ANDROID_HOME="$ANDROID_SDK_ROOT" export ANDROID_HOME="$ANDROID_SDK_ROOT"
mkdir -p "$ANDROID_SDK_ROOT/cmdline-tools" mkdir -p "$ANDROID_SDK_ROOT/cmdline-tools"
if [ ! -x "$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager" ]; then if [ ! -x "$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager" ]; then
curl -fsSL -o /tmp/commandlinetools.zip https://dl.google.com/android/repository/commandlinetools-linux-12266719_latest.zip tools_url="$(curl -fsSL https://developer.android.com/studio | grep -o 'https://dl.google.com/android/repository/commandlinetools-linux-[0-9][0-9]*_latest.zip' | head -n 1)"
test -n "$tools_url"
curl -fsSL -o /tmp/commandlinetools.zip "$tools_url"
rm -rf "$ANDROID_SDK_ROOT/cmdline-tools/latest" "$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools" rm -rf "$ANDROID_SDK_ROOT/cmdline-tools/latest" "$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools"
unzip -q /tmp/commandlinetools.zip -d "$ANDROID_SDK_ROOT/cmdline-tools" unzip -q /tmp/commandlinetools.zip -d "$ANDROID_SDK_ROOT/cmdline-tools"
mv "$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools" "$ANDROID_SDK_ROOT/cmdline-tools/latest" mv "$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools" "$ANDROID_SDK_ROOT/cmdline-tools/latest"
@@ -47,6 +53,40 @@ jobs:
"platforms;android-35" \ "platforms;android-35" \
"build-tools;35.0.0" "build-tools;35.0.0"
- name: Prepare optional release signing
if: github.event_name == 'release'
continue-on-error: true
env:
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
shell: bash
run: |
set -euo pipefail
missing=()
for key in ANDROID_KEYSTORE_BASE64 ANDROID_KEYSTORE_PASSWORD ANDROID_KEY_ALIAS ANDROID_KEY_PASSWORD; do
if [ -z "${!key:-}" ]; then
missing+=("$key")
fi
done
if [ ${#missing[@]} -gt 0 ]; then
printf -v missing_csv '%s, ' "${missing[@]}"
missing_csv="${missing_csv%, }"
echo "::error::Release signing secrets missing: ${missing_csv}. Continuing with unsigned/default-signed release AAB."
exit 1
fi
mkdir -p .ci-secrets
printf '%s' "$ANDROID_KEYSTORE_BASE64" | base64 -d > .ci-secrets/release-keystore.jks
cat > keystore.properties <<EOF
storeFile=.ci-secrets/release-keystore.jks
storePassword=$ANDROID_KEYSTORE_PASSWORD
keyAlias=$ANDROID_KEY_ALIAS
keyPassword=$ANDROID_KEY_PASSWORD
EOF
- name: Make Gradle wrapper executable - name: Make Gradle wrapper executable
run: chmod +x gradlew run: chmod +x gradlew
@@ -82,10 +122,17 @@ jobs:
path: app/build/outputs/apk/debug/*.apk path: app/build/outputs/apk/debug/*.apk
if-no-files-found: error if-no-files-found: error
- name: Upload release AAB - name: Attach release AAB to Gitea release
if: github.event_name == 'release' if: github.event_name == 'release'
uses: actions/upload-artifact@v3 env:
with: GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
name: release-aab shell: bash
path: app/build/outputs/bundle/release/*.aab run: |
if-no-files-found: error set -euxo pipefail
release_id="$(python3 -c 'import json, os; print(json.load(open(os.environ["GITHUB_EVENT_PATH"], encoding="utf-8"))["release"]["id"])')"
aab="$(find app/build/outputs/bundle/release -name '*.aab' | head -n 1)"
curl --fail-with-body \
--request POST \
--header "Authorization: token ${GITEA_TOKEN}" \
--form "attachment=@${aab}" \
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases/${release_id}/assets?name=$(basename "$aab")"

View File

@@ -1,9 +1,23 @@
import java.util.Properties
plugins { plugins {
id("com.android.application") id("com.android.application")
id("org.jetbrains.kotlin.android") id("org.jetbrains.kotlin.android")
id("org.jetbrains.kotlin.plugin.compose") id("org.jetbrains.kotlin.plugin.compose")
} }
val keystorePropertiesFile = rootProject.file("keystore.properties")
val keystoreProperties = Properties()
if (keystorePropertiesFile.exists()) {
keystorePropertiesFile.inputStream().use { keystoreProperties.load(it) }
}
val hasReleaseSigning = listOf(
"storeFile",
"storePassword",
"keyAlias",
"keyPassword",
).all { !keystoreProperties.getProperty(it).isNullOrBlank() }
android { android {
namespace = "solutions.tretter.esunandroid" namespace = "solutions.tretter.esunandroid"
compileSdk = 35 compileSdk = 35
@@ -19,6 +33,17 @@ android {
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
} }
signingConfigs {
if (hasReleaseSigning) {
create("release") {
storeFile = file(keystoreProperties.getProperty("storeFile"))
storePassword = keystoreProperties.getProperty("storePassword")
keyAlias = keystoreProperties.getProperty("keyAlias")
keyPassword = keystoreProperties.getProperty("keyPassword")
}
}
}
buildTypes { buildTypes {
release { release {
isMinifyEnabled = false isMinifyEnabled = false
@@ -26,6 +51,9 @@ android {
getDefaultProguardFile("proguard-android-optimize.txt"), getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro" "proguard-rules.pro"
) )
if (hasReleaseSigning) {
signingConfig = signingConfigs.getByName("release")
}
} }
} }