Skip to content

Commit

Permalink
update: multiple stages for the builds
Browse files Browse the repository at this point in the history
  • Loading branch information
sherlockwisdom committed Sep 5, 2023
1 parent 5df6a57 commit 381c1bb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
12 changes: 7 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:22.04
FROM ubuntu:22.04 AS base

RUN apt update && apt install -y openjdk-17-jdk openjdk-17-jre android-sdk sdkmanager

Expand All @@ -15,17 +15,19 @@ RUN yes | sdkmanager --licenses
ENV PASS=""

# CMD ./gradlew assembleDebug
FROM base as apk-builder
CMD ./gradlew assembleRelease && \
apksigner sign --ks app/keys/app-release-key.jks \
--ks-pass pass:$PASS \
--in app/build/outputs/apk/release/app-release-unsigned.apk \
--out app/build/outputs/apk/release/app-release.apk && \
sleep 3 && \
./gradlew assemble bundleRelease && \
--out app/build/outputs/apk/release/app-release.apk

FROM base as bundle-builder
CMD ./gradlew assemble bundleRelease && \
apksigner sign --ks app/keys/app-release-key.jks \
--ks-pass pass:$PASS \
--in app/build/outputs/bundle/release/app-release.aab \
--out app/build/outputs/bundle/release/app-bundle.apk
--out app/build/outputs/bundle/release/app-bundle.aab

# CMD cp app/build/outputs/apk/debug/app-debug.apk /apkbuilds/
# CMD sha256sum app/build/outputs/apk/debug/app-debug.apk
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,14 @@ info: check

check-diffoscope: ks.passwd
@echo "Building apk output: ${APP_1}"
@docker build -t deku_sms_app .
@docker build -t deku_sms_app --target apk-builder .
@docker run --name ${CONTAINER_NAME} -e PASS=$(pass) deku_sms_app && \
docker cp ${CONTAINER_NAME}:/android/app/build/outputs/apk/release/app-release.apk apk-outputs/${APP_1} && \
docker rm ${CONTAINER_NAME}
@sleep 3
@echo "Building apk output: ${APP_2}"
@docker run --name ${CONTAINER_NAME_1} -e PASS=$(pass) deku_sms_app && \
docker cp ${CONTAINER_NAME_1}:/android/app/build/outputs/apk/release/app-release.apk apk-outputs/${APP_2} && \
docker cp ${CONTAINER_NAME_1}:/android/app/build/outputs/bundle/release/app-bundle.apk apk-outputs/${aab_output} && \
docker rm ${CONTAINER_NAME_1}
@diffoscope apk-outputs/${APP_1} apk-outputs/${APP_2}
@echo $? | exit
Expand All @@ -97,6 +96,12 @@ build-apk:
--out apk-outputs/${apk_output}
@shasum apk-outputs/${apk_output}

build-aab-docker:
@docker build -t deku_sms_app --target bundle-builder .
@docker run --name ${CONTAINER_NAME} -e PASS=$(pass) deku_sms_app && \
docker cp ${CONTAINER_NAME}:/android/app/build/outputs/bundle/release/app-bundle.aab apk-outputs/${aab_output} && \
docker rm ${CONTAINER_NAME}

build-aab:
@echo "+ Building aab output: ${aab_output} - ${branch_name}"
@./gradlew clean bundleRelease
Expand Down Expand Up @@ -124,7 +129,7 @@ release-draft: release.properties bump_version build-apk build-aab
--status "draft" \
--github_url "${github_url}"

release-cd: bump_version info check-diffoscope
release-cd: bump_version info check-diffoscope build-aab-docker
@echo "+ Target branch for relase: ${branch}"
@git tag -f ${tagVersion}
@git push origin ${branch_name}
Expand Down

0 comments on commit 381c1bb

Please sign in to comment.