Add a custom Android CI/release build image and packaging scripts
build / build (push) Failing after 0s
build / build (push) Failing after 0s
- build-image/: Dockerfile bundling JDK 17, the Android SDK, and Node.js (needed by Gitea's JS-based actions) - the app has no native code, so no NDK - build-image.sh/upload-image.sh: extended to also build/push this image alongside the existing OCR pipeline tools image - run-image.sh: runs `make android` inside the image against a live checkout, for a CI-equivalent local build - Makefile: `make android` builds and versions a release APK into dist/, from the current git tag - .gitea/workflows/build.yml: now pulls the custom image and just runs `make android`, replacing the ad-hoc Node/SDK install steps - README.md: describes the pipeline, server, app, and build tooling - registry.env.example: fix REGISTRY_IMAGE to be fully-qualified (an unqualified name was silently resolving pushes to Docker Hub instead of the configured registry)
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
# Builds the Android app (android/) and packages a versioned release APK.
|
||||
# The OCR pipeline itself (tooling-container/, 0-3_*.sh, test_batch.sh) is
|
||||
# container-only and has no host build step, so this Makefile only covers
|
||||
# the Android app.
|
||||
|
||||
ANDROID_DIR := android
|
||||
ANDROID_APK := $(ANDROID_DIR)/app/build/outputs/apk/debug/app-debug.apk
|
||||
DIST_DIR := dist
|
||||
|
||||
.PHONY: all android clean
|
||||
|
||||
all: android
|
||||
|
||||
# Builds the Android app (`./gradlew assembleDebug` in android/, via its
|
||||
# own Gradle/AGP toolchain) and copies the resulting debug APK into
|
||||
# dist/, named with the current git tag, or `make android VERSION=1.2.3`
|
||||
# to override. Untagged builds (including every CI build, unless a
|
||||
# release tag is pushed) get a 0.0.0-dev+<sha> placeholder version.
|
||||
# Ships the auto-generated debug keystore, not a release signing config -
|
||||
# fine for sideloading; a real release signing setup is a separate,
|
||||
# not-yet-needed step. Requires the Android SDK (ANDROID_HOME set) - see
|
||||
# build-image/Dockerfile for the exact version this is built/tested
|
||||
# against, or run this inside it via ./run-image.sh.
|
||||
android:
|
||||
cd $(ANDROID_DIR) && ./gradlew assembleDebug
|
||||
@mkdir -p $(DIST_DIR)
|
||||
@V="$(VERSION)"; \
|
||||
if [ -z "$$V" ]; then \
|
||||
if TAG=$$(git describe --tags --exact-match --match 'v[0-9]*.[0-9]*.[0-9]*' 2>/dev/null); then \
|
||||
V=$${TAG#v}; \
|
||||
else \
|
||||
V="0.0.0-dev+$$(git rev-parse --short HEAD)"; \
|
||||
echo "WARNING: HEAD is not on a vX.Y.Z tag - building placeholder version $$V (push a tag to drive a real release version)" >&2; \
|
||||
fi; \
|
||||
fi; \
|
||||
case "$$V" in \
|
||||
[0-9]*.[0-9]*.[0-9]*) ;; \
|
||||
*) echo "PREFLIGHT FAIL: VERSION '$$V' is not a semantic version (expected X.Y.Z, optionally with a -pre+meta suffix)" >&2; exit 1;; \
|
||||
esac; \
|
||||
APK_NAME="fuelish-$$V.apk"; \
|
||||
cp $(ANDROID_APK) "$(DIST_DIR)/$$APK_NAME"; \
|
||||
echo "Wrote $(DIST_DIR)/$$APK_NAME"
|
||||
|
||||
clean:
|
||||
rm -rf $(DIST_DIR) $(ANDROID_DIR)/build $(ANDROID_DIR)/app/build
|
||||
Reference in New Issue
Block a user