diff --git a/.github/workflows/build-aab.yml b/.github/workflows/build-aab.yml new file mode 100644 index 0000000..b07f799 --- /dev/null +++ b/.github/workflows/build-aab.yml @@ -0,0 +1,55 @@ +on: + workflow_call: + outputs: + filename: + description: "artifact file name" + value: ${{ jobs.build-apk.outputs.filename }} + secrets: + key-alias: + required: false + keystore: + required: false + key-password: + required: false + +jobs: + build-aab: + runs-on: ubuntu-latest + outputs: + filename: ${{ steps.build_aab.outputs.upload_filename }} + steps: + - uses: actions/checkout@v3 + - name: Set up OpenJDK 17 + uses: actions/setup-java@v3 + with: + distribution: "zulu" + java-version: "17" + - name: Setup Android SDK + uses: android-actions/setup-android@v2 + - name: Install required platform + run: sdkmanager "platforms;android-33" "build-tools;33.0.2" + - name: Replace android.jar + run: | + curl -L https://github.com/Reginer/aosp-android-jar/raw/main/android-33/android.jar > /usr/local/lib/android/sdk/platforms/android-33/android.jar + - name: Build App Bundle + id: build_aab + run: | + ./gradlew bundleRelease + echo "upload_filename=${RUN_ID}-AAB" >> $GITHUB_OUTPUT + env: + RUN_ID: ${{ github.run_id }} + - name: Save keystore as file + run: echo "${KEYSTORE_B64}" | base64 -d > keystore.jks + env: + KEYSTORE_B64: ${{ secrets.keystore }} + - name: Sign APK + run: echo "${KEY_PASSWORD}" | $ANDROID_SDK_ROOT/build-tools/33.0.2/apksigner sign --ks keystore.jks --ks-key-alias "${KEY_ALIAS}" --key-pass "env:KEY_PASSWORD" --out dev.bluehouse.enablevolte.aab build/outputs/bundle/release/app-release.aab + env: + KEY_ALIAS: ${{ secrets.key-alias }} + KEY_PASSWORD: ${{ secrets.key-password }} + - name: Upload APK + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.build_apk.outputs.upload_filename }} + path: dev.bluehouse.enablevolte.aab + retention-days: 3 diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml index 5f771c9..aabcab0 100644 --- a/.github/workflows/default.yml +++ b/.github/workflows/default.yml @@ -57,8 +57,16 @@ jobs: key-alias: ${{ secrets.KEY_ALIAS }} keystore: ${{ secrets.KEYSTORE_B64 }} key-password: ${{ secrets.KEY_PASSWORD }} + build-app-bundle: + needs: [lint] + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') + uses: ./.github/workflows/build-aab.yml + secrets: + key-alias: ${{ secrets.KEY_ALIAS }} + keystore: ${{ secrets.KEYSTORE_B64 }} + key-password: ${{ secrets.KEY_PASSWORD }} release: - needs: [build-release-apk] + needs: [build-release-apk, build-app-bundle] runs-on: ubuntu-latest permissions: contents: write @@ -68,9 +76,16 @@ jobs: uses: actions/download-artifact@v3 with: name: ${{ needs.build-release-apk.outputs.filename }} + - name: Download App Bundle + id: download + uses: actions/download-artifact@v3 + with: + name: ${{ needs.build-app-bundle.outputs.filename }} - name: Release to GitHub uses: softprops/action-gh-release@v1 with: name: "v${{ github.ref_name }}" generate_release_notes: true - files: dev.bluehouse.enablevolte.apk + files: | + dev.bluehouse.enablevolte.apk + dev.bluehouse.enablevolte.aab