Skip to content

Commit

Permalink
Build app bundles
Browse files Browse the repository at this point in the history
  • Loading branch information
valldrac committed Jan 7, 2023
1 parent bd6c674 commit 0b3450b
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 14 additions & 6 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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 }}
22 changes: 15 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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]}'
Expand All @@ -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 }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions reproducible-builds/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions reproducible-builds/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.

0 comments on commit 0b3450b

Please sign in to comment.