From 40222b5ea31c8393822ae7af4a513d43ba981ee5 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Thu, 29 Sep 2022 19:29:33 +0100 Subject: [PATCH] adding automatic foss apk uploading to the release --- .github/workflows/release-candidate.yml | 6 +++++- tools/beta-release/release.js | 10 ++++++++++ tools/generate-fdroid-release.sh | 2 +- tools/generate-release.sh | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-candidate.yml b/.github/workflows/release-candidate.yml index a20d425..91f174d 100644 --- a/.github/workflows/release-candidate.yml +++ b/.github/workflows/release-candidate.yml @@ -34,11 +34,14 @@ jobs: touch .secrets/service-account.json touch .secrets/matrix.json echo -n '${{ secrets.UPLOAD_KEY }}' | base64 --decode >> .secrets/upload-key.jks + echo -n '${{ secrets.FDROID_KEY }}' | base64 --decode >> .secrets/fdroid.keystore echo -n '${{ secrets.SERVICE_ACCOUNT }}' | base64 --decode >> .secrets/service-account.json echo -n '${{ secrets.MATRIX }}' | base64 --decode >> .secrets/matrix.json - name: Assemble release variant - run: ./tools/generate-release.sh ${{ secrets.STORE_PASS }} + run: | + ./tools/generate-release.sh ${{ secrets.STORE_PASS }} + ./tools/generate-fdroid-release.sh ${{ secrets.FDROID_STORE_PASS }} - uses: actions/github-script@v6 with: @@ -48,6 +51,7 @@ jobs: const artifacts = { bundle: '${{ github.workspace }}/app/build/outputs/bundle/release/app-release.aab', mapping: '${{ github.workspace }}/app/build/outputs/mapping/release/mapping.txt', + fossApkPath: '${{ github.workspace }}/app/build/outputs/apk/release/app-foss-release-signed.apk', } await publishRelease(github, artifacts) diff --git a/tools/beta-release/release.js b/tools/beta-release/release.js index dfe83c7..358147c 100644 --- a/tools/beta-release/release.js +++ b/tools/beta-release/release.js @@ -56,6 +56,7 @@ export const release = async (github, version, applicationId, artifacts, config) console.log(releaseResult.data.id) + console.log("Uploading universal apk...") await github.rest.repos.uploadReleaseAsset({ owner: config.owner, repo: config.repo, @@ -64,6 +65,15 @@ export const release = async (github, version, applicationId, artifacts, config) data: fs.readFileSync(universalApkPath) }) + console.log("Uploading foss apk...") + await github.rest.repos.uploadReleaseAsset({ + owner: config.owner, + repo: config.repo, + release_id: releaseResult.data.id, + name: `foss-signed-${version.name}.apk`, + data: fs.readFileSync(artifacts.fossApkPath) + }) + console.log("Promoting beta draft release to live...") await promoteDraftToLive(applicationId) diff --git a/tools/generate-fdroid-release.sh b/tools/generate-fdroid-release.sh index bf4d074..e1ff974 100755 --- a/tools/generate-fdroid-release.sh +++ b/tools/generate-fdroid-release.sh @@ -9,7 +9,7 @@ SIGNED=$WORKING_DIR/app-foss-release-signed.apk ZIPALIGN=$(find "$ANDROID_HOME" -iname zipalign -print -quit) APKSIGNER=$(find "$ANDROID_HOME" -iname apksigner -print -quit) -./gradlew clean assembleRelease -Pfoss -Punsigned --no-daemon --no-configuration-cache --no-build-cache +./gradlew assembleRelease -Pfoss -Punsigned --no-daemon --no-configuration-cache --no-build-cache $ZIPALIGN -v -p 4 $UNSIGNED $ALIGNED_UNSIGNED diff --git a/tools/generate-release.sh b/tools/generate-release.sh index 16ae11f..ea757a4 100755 --- a/tools/generate-release.sh +++ b/tools/generate-release.sh @@ -1,6 +1,6 @@ #! /bin/bash -./gradlew clean bundleRelease -Punsigned --no-daemon --no-configuration-cache --no-build-cache +./gradlew bundleRelease -Punsigned --no-daemon --no-configuration-cache --no-build-cache WORKING_DIR=app/build/outputs/bundle/release RELEASE_AAB=$WORKING_DIR/app-release.aab