1name: Android Client - EAS Build 2 3on: 4 workflow_dispatch: 5 inputs: 6 buildType: 7 required: true 8 type: 'choice' 9 description: 'buildType' 10 options: 11 - versioned-client 12 - unversioned-client 13 - versioned-client-add-sdk 14 schedule: 15 # 5:20 AM UTC time on every Monday, Wednesday and Friday 16 # Build a versioned client 17 - cron: '20 5 * * 1,3,5' 18 # 5:20 AM UTC time on every Monday 19 # Run versioning process for the next sdk and build a versioned client 20 - cron: '20 5 * * 1' 21 pull_request: 22 paths: 23 - .github/workflows/client-android-eas.yml 24 - apps/eas-expo-go/** 25 - android/versioned-abis/** 26 - android/versioned-react-native/** 27 - android/expoview/** 28 - android/**/*.gradle 29 push: 30 branches: [main, sdk-*] 31 paths: 32 - .github/workflows/client-android-eas.yml 33 - apps/eas-expo-go/** 34 - android/versioned-abis/** 35 - android/versioned-react-native/** 36 - android/expoview/** 37 - android/**/*.gradle 38 39concurrency: 40 group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }} 41 cancel-in-progress: true 42 43jobs: 44 build: 45 runs-on: ubuntu-22.04 46 if: ${{ github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }} 47 steps: 48 - name: Checkout 49 uses: actions/checkout@v3 50 with: 51 submodules: true 52 - name: Decrypt secrets if possible 53 uses: ./.github/actions/expo-git-decrypt 54 with: 55 key: ${{ secrets.GIT_CRYPT_KEY_BASE64 }} 56 - name: ➕ Add `bin` to GITHUB_PATH 57 run: echo "$(pwd)/bin" >> $GITHUB_PATH 58 - name: ♻️ Restore caches 59 uses: ./.github/actions/expo-caches 60 id: expo-caches 61 with: 62 yarn-workspace: 'true' 63 yarn-tools: 'true' 64 - name: Yarn install 65 if: steps.expo-caches.outputs.yarn-workspace-hit != 'true' 66 run: yarn install --frozen-lockfile 67 - name: Install eas-cli 68 run: npm install -g eas-cli 69 - name: Check which flavor to build 70 id: flavor 71 uses: dorny/paths-filter@v2 72 with: 73 # this action fails when base is not set on schedule event 74 base: ${{ github.ref }} 75 filters: | 76 versioned: 77 - android/versioned-abis/** 78 - android/versioned-react-native/** 79 - android/expoview/src/versioned/** 80 - android/expoview/src/main/java/versioned/** 81 - android/**/*.gradle 82 - name: Resolve profile 83 id: profile 84 run: | 85 DISPATCH_PROFILE="${{ github.event.inputs.buildType }}" 86 IS_VERSIONED="${{ steps.flavor.outputs.versioned }}" 87 if [[ ! -z "$DISPATCH_PROFILE" ]]; then 88 echo "profile=$DISPATCH_PROFILE" >> $GITHUB_OUTPUT 89 elif [[ "${{ github.event.schedule }}" == "20 5 * * 1,3,5" ]]; then 90 echo "profile=versioned-client" >> $GITHUB_OUTPUT 91 elif [[ "${{ github.event.schedule }}" == "20 5 * * 1" ]]; then 92 echo "profile=versioned-client-add-sdk" >> $GITHUB_OUTPUT 93 elif [[ "$IS_VERSIONED" == "true" ]]; then 94 echo "profile=versioned-client" >> $GITHUB_OUTPUT 95 else 96 echo "profile=unversioned-client" >> $GITHUB_OUTPUT 97 fi 98 - name: Generate local credentials.json 99 working-directory: ./apps/eas-expo-go 100 run: | 101 cat >credentials.json <<EOL 102 { 103 "android": { 104 "keystore": { 105 "keystorePath": "release.keystore", 106 "keystorePassword": "$ANDROID_KEYSTORE_PASSWORD", 107 "keyAlias": "ExponentKey", 108 "keyPassword": "$ANDROID_KEY_PASSWORD" 109 } 110 } 111 } 112 EOL 113 echo $ANDROID_KEYSTORE_B64 | base64 -d > release.keystore 114 env: 115 ANDROID_KEYSTORE_B64: ${{ secrets.ANDROID_KEYSTORE_B64 }} 116 ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} 117 ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }} 118 - name: Build 119 uses: ./.github/actions/eas-build 120 id: build 121 with: 122 platform: 'android' 123 profile: ${{ steps.profile.outputs.profile }} 124 projectRoot: './apps/eas-expo-go' 125 expoToken: ${{ secrets.EAS_BUILD_BOT_TOKEN }} 126 noWait: ${{ github.event.schedule }} 127 message: ${{ github.event.pull_request.title }} 128 - name: On workflow canceled 129 if: ${{ cancelled() && steps.build.outputs.build_id }} 130 run: eas build:cancel ${{ steps.build.outputs.build_id }} 131 working-directory: ./apps/eas-expo-go 132 env: 133 EXPO_TOKEN: ${{ secrets.EAS_BUILD_BOT_TOKEN }} 134 EAS_BUILD_PROFILE: ${{ steps.profile.outputs.profile }} 135