ci: build both debug and release APKs, attach both to release
dev / Build debug APK (push) Failing after 17s

This commit is contained in:
Incido Developer committed 2026-08-20 07:31:05 +12:00
1 parent b95d1814f9
commit c73cd4c816
2 files changed
+31 -20

No files matched your search

+27 -16
View File
@@ -67,7 +67,7 @@ jobs:
-keypass incido_dev_keystore \ -keypass incido_dev_keystore \
-dname "CN=Incido Dev, OU=Local, O=Incido, L=Local, ST=Local, C=NZ" -dname "CN=Incido Dev, OU=Local, O=Incido, L=Local, ST=Local, C=NZ"
- name: Build release APK - name: Build debug + release APKs
env: env:
GITHUB_TOKEN: ${{ secrets.TOKEN }} GITHUB_TOKEN: ${{ secrets.TOKEN }}
run: | run: |
@@ -78,17 +78,23 @@ jobs:
export ANDROID_HOME=/tmp/gitea-runner-work/android-sdk export ANDROID_HOME=/tmp/gitea-runner-work/android-sdk
export PATH=$JAVA_HOME/bin:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools:$PATH export PATH=$JAVA_HOME/bin:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools:$PATH
# Build release APK # Build both variants; copyReleaseApks finalizes assembleRelease and
./gradlew assembleRelease --no-daemon # drops version-stamped APKs at the repo root:
# Incido-<version>-debug.apk
# Incido-<version>-release.apk
./gradlew assembleDebug assembleRelease --no-daemon
# Find the APK # Verify both files exist before proceeding
TAG="${GITHUB_REF##*/}" TAG="${GITHUB_REF##*/}"
APK=$(find app/build/outputs -name '*.apk' | head -1)
echo "APK_PATH=$APK" >> $GITHUB_ENV
echo "APK_NAME=$(basename $APK)" >> $GITHUB_ENV
echo "Built APK: $APK"
# Create release and attach APK in one step - name: Create release + attach both APKs
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
run: |
cd repo
TAG="${GITHUB_REF##*/}"
VERSION="${TAG#v}"
echo "Creating release for tag: $TAG" echo "Creating release for tag: $TAG"
RELEASE_ID=$(curl -s -X POST "https://git.trevena.info/api/v1/repos/nick/incido/releases" \ RELEASE_ID=$(curl -s -X POST "https://git.trevena.info/api/v1/repos/nick/incido/releases" \
-H "Authorization: token $GITHUB_TOKEN" \ -H "Authorization: token $GITHUB_TOKEN" \
@@ -101,12 +107,17 @@ jobs:
}" | python3 -c "import sys,json; print(json.load(sys.stdin).get('id','') or '')") }" | python3 -c "import sys,json; print(json.load(sys.stdin).get('id','') or '')")
echo "Release ID: $RELEASE_ID" echo "Release ID: $RELEASE_ID"
if [ -n "$RELEASE_ID" ] && [ -f "$APK" ]; then if [ -z "$RELEASE_ID" ]; then
curl -s -X POST "https://git.trevena.info/api/v1/repos/nick/incido/releases/$RELEASE_ID/assets?name=$(basename $APK)" \ echo "ERROR: Failed to create release"
exit 1
fi
for APK in "Incido-${VERSION}-debug.apk" "Incido-${VERSION}-release.apk"; do
echo "Attaching $APK to release $RELEASE_ID"
RESPONSE=$(curl -s -X POST \
"https://git.trevena.info/api/v1/repos/nick/incido/releases/$RELEASE_ID/assets?name=$APK" \
-H "Authorization: token $GITHUB_TOKEN" \ -H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/octet-stream" \ -H "Content-Type: application/octet-stream" \
--data-binary "@$APK" --data-binary "@$APK")
echo "APK $(basename $APK) attached to release $TAG" echo "Attach response: $RESPONSE"
else done
echo "WARNING: Could not attach APK (release_id=$RELEASE_ID, apk_exists=$(test -f '$APK' && echo yes || echo no))"
fi
+4 -4
View File
@@ -110,7 +110,7 @@ android {
} }
// v0.3.6.0: ship version-stamped APKs at the repo root for every // v0.3.6.0: ship version-stamped APKs at the repo root for every
// release (e.g. `incido-0.3.6.0-debug.apk`, `incido-0.3.6.0.apk`). // release (e.g. `Incido-0.3.6.0-debug.apk`, `Incido-0.3.6.0-release.apk`).
// See Incido Development Plan §11 for the full release build // See Incido Development Plan §11 for the full release build
// procedure. // procedure.
// //
@@ -130,7 +130,7 @@ val copyReleaseApks = tasks.register("copyReleaseApks") {
group = "build" group = "build"
description = "Copies debug + release APKs to the repo root, " + description = "Copies debug + release APKs to the repo root, " +
"stamped with the current versionName " + "stamped with the current versionName " +
"(e.g. incido-0.3.6.0-debug.apk, incido-0.3.6.0.apk). " + "(e.g. Incido-0.3.6.3-debug.apk, Incido-0.3.6.3-release.apk). " +
"See Incido Development Plan §11." "See Incido Development Plan §11."
dependsOn("assembleDebug", "assembleRelease") dependsOn("assembleDebug", "assembleRelease")
doLast { doLast {
@@ -138,8 +138,8 @@ val copyReleaseApks = tasks.register("copyReleaseApks") {
val rootDir = rootProject.projectDir val rootDir = rootProject.projectDir
val debugSrc = file("$buildDir/outputs/apk/debug/app-debug.apk") val debugSrc = file("$buildDir/outputs/apk/debug/app-debug.apk")
val releaseSrc = file("$buildDir/outputs/apk/release/app-release.apk") val releaseSrc = file("$buildDir/outputs/apk/release/app-release.apk")
val debugDest = file("$rootDir/incido-${versionName}-debug.apk") val debugDest = file("$rootDir/Incido-${versionName}-debug.apk")
val releaseDest = file("$rootDir/incido-${versionName}.apk") val releaseDest = file("$rootDir/Incido-${versionName}-release.apk")
if (debugSrc.exists()) { if (debugSrc.exists()) {
debugSrc.copyTo(debugDest, overwrite = true) debugSrc.copyTo(debugDest, overwrite = true)
logger.lifecycle("Copied: ${debugDest.absolutePath}") logger.lifecycle("Copied: ${debugDest.absolutePath}")