|
| 1 | +name: Build Android |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - testing |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + name: Build Android Testing |
| 12 | + runs-on: ubuntu-latest |
| 13 | + env: |
| 14 | + VITE_DROPBOX_CLIENT_ID: ${{ secrets.DROPBOX_CLIENT_ID }} |
| 15 | + VITE_DROPBOX_CLIENT_SECRET: ${{ secrets.DROPBOX_CLIENT_SECRET }} |
| 16 | + VITE_IOS_GOOGLE_CLIENT_ID: ${{ secrets.IOS_GOOGLE_CLIENT_ID }} |
| 17 | + VITE_ANDROID_GOOGLE_CLIENT_ID: ${{ secrets.ANDROID_GOOGLE_CLIENT_ID }} |
| 18 | + VITE_ONEDRIVE_CLIENT_ID: ${{ secrets.ONEDRIVE_CLIENT_ID }} |
| 19 | + VITE_ONEDRIVE_ANDROID_HASH: ${{ secrets.ONEDRIVE_ANDROID_HASH }} |
| 20 | + |
| 21 | + steps: |
| 22 | + - name: Checkout source |
| 23 | + uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Setup Java |
| 26 | + uses: actions/setup-java@v4 |
| 27 | + with: |
| 28 | + distribution: "zulu" |
| 29 | + java-version: "21" |
| 30 | + |
| 31 | + - name: Install unzip (required by setup-android when using act) |
| 32 | + run: sudo apt-get update && sudo apt-get install -y unzip |
| 33 | + |
| 34 | + - name: Setup Android SDK |
| 35 | + uses: android-actions/setup-android@v3 |
| 36 | + |
| 37 | + - name: Setup Node.js |
| 38 | + uses: actions/setup-node@v4 |
| 39 | + with: |
| 40 | + node-version: 20 |
| 41 | + cache: "yarn" |
| 42 | + |
| 43 | + - name: Create .env file |
| 44 | + run: | |
| 45 | + cat <<EOF > .env |
| 46 | + VITE_DROPBOX_CLIENT_ID=${VITE_DROPBOX_CLIENT_ID} |
| 47 | + VITE_DROPBOX_CLIENT_SECRET=${VITE_DROPBOX_CLIENT_SECRET} |
| 48 | + VITE_IOS_GOOGLE_CLIENT_ID=${VITE_IOS_GOOGLE_CLIENT_ID} |
| 49 | + VITE_ANDROID_GOOGLE_CLIENT_ID=${VITE_ANDROID_GOOGLE_CLIENT_ID} |
| 50 | + VITE_ONEDRIVE_CLIENT_ID=${VITE_ONEDRIVE_CLIENT_ID} |
| 51 | + VITE_ONEDRIVE_ANDROID_HASH=${VITE_ONEDRIVE_ANDROID_HASH} |
| 52 | + EOF |
| 53 | +
|
| 54 | + - name: Install app dependencies |
| 55 | + run: yarn install --frozen-lockfile |
| 56 | + |
| 57 | + - name: Build project |
| 58 | + run: yarn build |
| 59 | + |
| 60 | + - name: Capacitor sync |
| 61 | + run: npx cap sync |
| 62 | + |
| 63 | + - name: Extract Android signing key from env |
| 64 | + env: |
| 65 | + RELEASE_KEYSTORE_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }} |
| 66 | + RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }} |
| 67 | + run: | |
| 68 | + echo "${{ secrets.RELEASE_KEYSTORE }}" > android/app/release.jks.base64 |
| 69 | + base64 -d android/app/release.jks.base64 > android/app/release.jks |
| 70 | +
|
| 71 | + - name: Build AAB (Android App Bundle) |
| 72 | + env: |
| 73 | + RELEASE_KEYSTORE_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }} |
| 74 | + RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }} |
| 75 | + run: cd android && ./gradlew bundleRelease |
| 76 | + |
| 77 | + - name: Build APK |
| 78 | + env: |
| 79 | + RELEASE_KEYSTORE_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }} |
| 80 | + RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }} |
| 81 | + run: cd android && ./gradlew assembleRelease |
| 82 | + |
| 83 | + - name: Upload release AAB |
| 84 | + uses: actions/upload-artifact@v4 |
| 85 | + with: |
| 86 | + name: app-release-aab |
| 87 | + path: android/app/build/outputs/bundle/release/app-release.aab |
| 88 | + retention-days: 60 |
| 89 | + |
| 90 | + - name: Upload release APK |
| 91 | + uses: actions/upload-artifact@v4 |
| 92 | + with: |
| 93 | + name: app-release-apk |
| 94 | + path: android/app/build/outputs/apk/release/app-release.apk |
| 95 | + retention-days: 60 |
| 96 | + |
| 97 | + - name: Cleanup keystore |
| 98 | + run: rm android/app/release.jks.base64 android/app/release.jks |
0 commit comments