From 0b3450b0b174c87e8c44164026b263afd981377e Mon Sep 17 00:00:00 2001 From: Oscar Mira Date: Sat, 7 Jan 2023 01:25:55 +0100 Subject: [PATCH] Build app bundles --- .dockerignore | 2 +- .github/workflows/prerelease.yml | 20 +++++++++++++------ .github/workflows/release.yml | 22 ++++++++++++++------- .gitignore | 2 +- reproducible-builds/README.md | 4 ++-- reproducible-builds/docker-compose.yml | 4 ++-- reproducible-builds/{apks => outputs}/.keep | 0 7 files changed, 35 insertions(+), 19 deletions(-) rename reproducible-builds/{apks => outputs}/.keep (100%) diff --git a/.dockerignore b/.dockerignore index 6c402db37c..8f595b4d9c 100644 --- a/.dockerignore +++ b/.dockerignore @@ -10,5 +10,5 @@ **/signing.properties **/test/androidTestEspresso/res/values/arrays.xml reproducible-builds/certs -reproducible-builds/apks +reproducible-builds/outputs reproducible-builds/test-reports diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index ec9d8c6b42..ccc84d7ee4 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -38,12 +38,12 @@ jobs: env: TEST_KEYSTORE: ${{ secrets.TEST_KEYSTORE }} - - name: Build APKs + - name: Build pre-release if: "env.HAVE_TEST_KEYSTORE == 'false'" run: docker-compose --env-file ci/prerelease.env run assemble working-directory: reproducible-builds - - name: Build and sign APKs + - name: Build and sign pre-release if: "env.HAVE_TEST_KEYSTORE == 'true'" run: docker-compose --env-file ci/prerelease.env run assemble working-directory: reproducible-builds @@ -58,13 +58,21 @@ jobs: working-directory: reproducible-builds - name: Log checksums - run: find reproducible-builds/apks -name "*.apk" -exec sha256sum '{}' + + run: find outputs \( -name "*.aab" -o -name "*.apk" \) -exec sha256sum '{}' + + working-directory: reproducible-builds - name: Upload APKs uses: actions/upload-artifact@v3 with: - name: build - path: reproducible-builds/apks/*/release/*.apk + name: apk + path: reproducible-builds/outputs/apk/*/release/*.apk + if-no-files-found: error + + - name: Upload Bundles + uses: actions/upload-artifact@v3 + with: + name: bundle + path: reproducible-builds/outputs/bundle/*Release/*.aab if-no-files-found: error publish: @@ -81,6 +89,6 @@ jobs: uses: actions/download-artifact@v3 - name: Create pre-release draft - run: gh release create -d -p -t "$GITHUB_REF_NAME Insider" "$GITHUB_REF_NAME" ./build/*/release/*.apk + run: gh release create -d -p -t "$GITHUB_REF_NAME" "$GITHUB_REF_NAME" ./apk/*/release/*.apk env: GITHUB_TOKEN: ${{ secrets.PUBLISH_PAT || secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2745e09777..15220740c2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,12 +38,12 @@ jobs: env: RELEASE_KEYSTORE: ${{ secrets.RELEASE_KEYSTORE }} - - name: Build APKs + - name: Build release if: "env.HAVE_RELEASE_KEYSTORE == 'false'" run: docker-compose --env-file ci/release.env run assemble working-directory: reproducible-builds - - name: Build and sign APKs + - name: Build and sign release if: "env.HAVE_RELEASE_KEYSTORE == 'true'" run: docker-compose --env-file ci/release.env run assemble working-directory: reproducible-builds @@ -58,13 +58,21 @@ jobs: working-directory: reproducible-builds - name: Log checksums - run: find reproducible-builds/apks -name "*.apk" -exec sha256sum '{}' + + run: find outputs \( -name "*.aab" -o -name "*.apk" \) -exec sha256sum '{}' + + working-directory: reproducible-builds - name: Upload APKs uses: actions/upload-artifact@v3 with: - name: build - path: reproducible-builds/apks/*/release/*.apk + name: apk + path: reproducible-builds/outputs/apk/*/release/*.apk + if-no-files-found: error + + - name: Upload Bundles + uses: actions/upload-artifact@v3 + with: + name: bundle + path: reproducible-builds/outputs/bundle/*Release/*.aab if-no-files-found: error publish: @@ -85,7 +93,7 @@ jobs: gh release list --exclude-drafts gh release download --pattern '*.apk' --dir latest || exit 0 latest_apks=(latest/*.apk) - build_apks=(build/*/release/*.apk) + build_apks=(apk/*/release/*.apk) version_code() { local aapt=($ANDROID_HOME/build-tools/30.*/aapt) $aapt d badging "$1" | gawk 'match($0, /^package:.*versionCode=.([0-9]+)/, v) {print v[1]}' @@ -95,6 +103,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Create release draft - run: gh release create -d -t "$GITHUB_REF_NAME" "$GITHUB_REF_NAME" ./build/*/release/*.apk + run: gh release create -d -t "$GITHUB_REF_NAME" "$GITHUB_REF_NAME" ./apk/*/release/*.apk env: GITHUB_TOKEN: ${{ secrets.PUBLISH_PAT || secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 5929d1ec5b..8558e66f8e 100644 --- a/.gitignore +++ b/.gitignore @@ -10,5 +10,5 @@ local.properties signing.properties test/androidTestEspresso/res/values/arrays.xml /reproducible-builds/certs -/reproducible-builds/apks +/reproducible-builds/outputs /reproducible-builds/test-reports diff --git a/reproducible-builds/README.md b/reproducible-builds/README.md index 4de76c453b..e94fcf21b7 100644 --- a/reproducible-builds/README.md +++ b/reproducible-builds/README.md @@ -42,10 +42,10 @@ wget https://github.com/mollyim/mollyim-android/releases/download/$VERSION/Molly wget https://github.com/mollyim/mollyim-android/releases/download/$VERSION/Molly-$VERSION-FOSS.apk # Run the diff script to compare the APKs -python apkdiff/apkdiff.py Molly-$VERSION.apk apks/prodGmsWebsite/release/Molly-unsigned-$VERSION.apk +python apkdiff/apkdiff.py Molly-$VERSION.apk outputs/apk/prodGmsWebsite/release/Molly-unsigned-$VERSION.apk # Run the diff script to compare the APKs (FOSS) -python apkdiff/apkdiff.py Molly-$VERSION-FOSS.apk apks/prodFossWebsite/release/Molly-unsigned-$VERSION-FOSS.apk +python apkdiff/apkdiff.py Molly-$VERSION-FOSS.apk outputs/apk/prodFossWebsite/release/Molly-unsigned-$VERSION-FOSS.apk # Clean up the Docker environment docker-compose down diff --git a/reproducible-builds/docker-compose.yml b/reproducible-builds/docker-compose.yml index f0aec1bc9a..96450bcdd4 100644 --- a/reproducible-builds/docker-compose.yml +++ b/reproducible-builds/docker-compose.yml @@ -4,10 +4,10 @@ services: image: reproducible-molly build: context: .. - command: :app:assembleRelease + command: :app:assembleRelease :app:bundleRelease volumes: - ./certs:/molly/app/certs:ro - - ./apks:/molly/app/build/outputs/apk + - ./outputs:/molly/app/build/outputs environment: - CI_APP_TITLE - CI_APP_FILENAME diff --git a/reproducible-builds/apks/.keep b/reproducible-builds/outputs/.keep similarity index 100% rename from reproducible-builds/apks/.keep rename to reproducible-builds/outputs/.keep