Skip to content

Commit

Permalink
ci: build and publish App Bundle (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyujin-cho authored Jan 20, 2024
1 parent 41c4f00 commit 21f783b
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 3 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/build-aab.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
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 \
--min-sdk-version $(cat app/build.gradle | grep minSdk | awk '{print $2}') \
app/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_aab.outputs.upload_filename }}
path: dev.bluehouse.enablevolte.aab
retention-days: 3
21 changes: 18 additions & 3 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,35 @@ 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
steps:
- name: Download APK
id: download
id: download-apk
uses: actions/download-artifact@v3
with:
name: ${{ needs.build-release-apk.outputs.filename }}
- name: Download App Bundle
id: download-bundle
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

0 comments on commit 21f783b

Please sign in to comment.