|
| 1 | +name: Build and profile Android apps |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +jobs: |
| 7 | + buildHybridAppAndroid: |
| 8 | + name: Build HybridApp Android |
| 9 | + runs-on: ubuntu-latest-xl |
| 10 | + steps: |
| 11 | + - name: Checkout |
| 12 | + uses: actions/checkout@v4 |
| 13 | + with: |
| 14 | + submodules: true |
| 15 | + token: ${{ secrets.OS_BOTIFY_TOKEN }} |
| 16 | + |
| 17 | + - name: Update submodule to match main |
| 18 | + run: | |
| 19 | + git submodule update --init --remote |
| 20 | + cd Mobile-Expensify |
| 21 | + git fetch |
| 22 | + git checkout main |
| 23 | +
|
| 24 | + - name: Configure MapBox SDK |
| 25 | + run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} |
| 26 | + |
| 27 | + - name: Setup Node |
| 28 | + id: setup-node |
| 29 | + uses: ./.github/actions/composite/setupNode |
| 30 | + with: |
| 31 | + IS_HYBRID_BUILD: 'true' |
| 32 | + |
| 33 | + - name: Run grunt build |
| 34 | + run: | |
| 35 | + cd Mobile-Expensify |
| 36 | + npm run grunt:build:shared |
| 37 | +
|
| 38 | + - name: Setup Java |
| 39 | + uses: actions/setup-java@v4 |
| 40 | + with: |
| 41 | + distribution: 'oracle' |
| 42 | + java-version: '17' |
| 43 | + |
| 44 | + - name: Setup Ruby |
| 45 | + uses: ruby/setup-ruby@v1.190.0 |
| 46 | + with: |
| 47 | + bundler-cache: true |
| 48 | + |
| 49 | + - name: Install New Expensify Gems |
| 50 | + run: bundle install |
| 51 | + |
| 52 | + - name: Install 1Password CLI |
| 53 | + uses: 1password/install-cli-action@v1 |
| 54 | + |
| 55 | + - name: Load files from 1Password |
| 56 | + env: |
| 57 | + OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} |
| 58 | + run: | |
| 59 | + op document get --output ./upload-key.keystore upload-key.keystore |
| 60 | + op document get --output ./android-fastlane-json-key.json android-fastlane-json-key.json |
| 61 | + # Copy the keystore to the Android directory for Fullstory |
| 62 | + cp ./upload-key.keystore Mobile-Expensify/Android |
| 63 | +
|
| 64 | + - name: Load Android upload keystore credentials from 1Password |
| 65 | + id: load-credentials |
| 66 | + uses: 1password/load-secrets-action@v2 |
| 67 | + with: |
| 68 | + export-env: false |
| 69 | + env: |
| 70 | + OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} |
| 71 | + ANDROID_UPLOAD_KEYSTORE_PASSWORD: op://Mobile-Deploy-CI/Repository-Secrets/ANDROID_UPLOAD_KEYSTORE_PASSWORD |
| 72 | + ANDROID_UPLOAD_KEYSTORE_ALIAS: op://Mobile-Deploy-CI/Repository-Secrets/ANDROID_UPLOAD_KEYSTORE_ALIAS |
| 73 | + ANDROID_UPLOAD_KEY_PASSWORD: op://Mobile-Deploy-CI/Repository-Secrets/ANDROID_UPLOAD_KEY_PASSWORD |
| 74 | + |
| 75 | + - name: Build Android Release |
| 76 | + working-directory: Mobile-Expensify/Android |
| 77 | + run: | |
| 78 | + ./gradlew --profile assembleRelease \ |
| 79 | + -Pandroid.injected.signing.store.file="./upload-key.keystore" \ |
| 80 | + -Pandroid.injected.signing.store.password=${{ steps.load-credentials.outputs.ANDROID_UPLOAD_KEYSTORE_PASSWORD }} \ |
| 81 | + -Pandroid.injected.signing.key.alias=${{ steps.load-credentials.outputs.ANDROID_UPLOAD_KEYSTORE_ALIAS }} \ |
| 82 | + -Pandroid.injected.signing.key.password=${{ steps.load-credentials.outputs.ANDROID_UPLOAD_KEY_PASSWORD }} |
| 83 | + |
| 84 | + echo "Printing Gradle profile report:" |
| 85 | + # Print the latest generated profile report |
| 86 | + PROFILE_REPORT=$(find build/reports/profile -maxdepth 1 -type f) |
| 87 | + cat "$PROFILE_REPORT" |
| 88 | +
|
| 89 | + buildStandaloneAndroid: |
| 90 | + name: Build Standalone Android |
| 91 | + runs-on: ubuntu-latest-xl |
| 92 | + steps: |
| 93 | + - name: Checkout |
| 94 | + uses: actions/checkout@v4 |
| 95 | + with: |
| 96 | + token: ${{ secrets.OS_BOTIFY_TOKEN }} |
| 97 | + |
| 98 | + - name: Configure MapBox SDK |
| 99 | + run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} |
| 100 | + |
| 101 | + - name: Setup Node |
| 102 | + id: setup-node |
| 103 | + uses: ./.github/actions/composite/setupNode |
| 104 | + with: |
| 105 | + IS_HYBRID_BUILD: 'false' |
| 106 | + |
| 107 | + - name: Decrypt keystore to sign the APK/AAB |
| 108 | + run: gpg --batch --yes --decrypt --passphrase="${{ secrets.LARGE_SECRET_PASSPHRASE }}" --output my-upload-key.keystore my-upload-key.keystore.gpg |
| 109 | + working-directory: android/app |
| 110 | + |
| 111 | + - name: Build Android Release |
| 112 | + working-directory: android |
| 113 | + env: |
| 114 | + MYAPP_UPLOAD_STORE_PASSWORD: ${{ secrets.MYAPP_UPLOAD_STORE_PASSWORD }} |
| 115 | + MYAPP_UPLOAD_KEY_PASSWORD: ${{ secrets.MYAPP_UPLOAD_KEY_PASSWORD }} |
| 116 | + run: | |
| 117 | + ./gradlew --profile assembleProductionRelease |
| 118 | +
|
| 119 | + echo "Printing Gradle profile report:" |
| 120 | + # Print the latest generated profile report |
| 121 | + PROFILE_REPORT=$(find build/reports/profile -maxdepth 1 -type f) |
| 122 | + cat "$PROFILE_REPORT" |
0 commit comments