1name: Android Shell App
2
3on:
4  workflow_dispatch: {}
5  schedule:
6    - cron: '20 5 * * 2,4,6' # 5:20 AM UTC time on every Tuesday, Thursday and Saturday
7  push:
8    paths:
9      - .github/workflows/shell-app-android.yml
10
11concurrency:
12  group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
13  cancel-in-progress: true
14
15jobs:
16  build:
17    runs-on: ubuntu-20.04
18    strategy:
19      matrix:
20        ndk-version: [21.4.7075529]
21    steps:
22      - name: �� Checkout
23        uses: actions/checkout@v3
24        with:
25          submodules: true
26      - name: �� Use JDK 11
27        uses: actions/setup-java@v3
28        with:
29          distribution: 'temurin'
30          java-version: '11'
31      - name: ➕ Add `EXPO_ROOT_DIR` to GITHUB_ENV
32        run: echo "EXPO_ROOT_DIR=$(pwd)" >> $GITHUB_ENV
33      - name: ➕ Add `bin` to GITHUB_PATH
34        run: echo "$(pwd)/bin" >> $GITHUB_PATH
35      - name: ♻️ Restore caches
36        uses: ./.github/actions/expo-caches
37        id: expo-caches
38        with:
39          yarn-workspace: 'true'
40          git-lfs: 'true'
41          ndk: 'true'
42          ndk-version: ${{ matrix.ndk-version }}
43          hermes-engine-aar: 'true'
44      - name: �� Pull Git LFS files
45        run: git lfs pull
46      - name: �� Yarn install
47        if: steps.expo-caches.outputs.yarn-workspace-hit != 'true'
48        run: yarn install --frozen-lockfile
49      - name: ��️ Build Android packages
50        env:
51          ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/${{ matrix.ndk-version }}/
52        run: expotools android-build-packages --packages all
53      - name: �� Clean Android build artifacts that would needlessly bloat the shell app
54        env:
55          ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/${{ matrix.ndk-version }}/
56        run: ./gradlew clean
57        working-directory: android
58      - name: ��️ Build shell app tarball
59        run: ./buildAndroidTarballLocally.sh
60      - name: ��️ Make an artifact
61        uses: actions/upload-artifact@v3
62        with:
63          name: android-shell-app
64          path: artifacts/android-shell-builder.tar.gz
65      - name: ��️ Upload shell app tarball to S3
66        if: ${{ github.event_name == 'workflow_dispatch' }}
67        env:
68          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
69          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
70          AWS_DEFAULT_REGION: 'us-east-1'
71          S3_URI: s3://exp-artifacts/android-shell-builder-${{ github.sha }}.tar.gz
72        run: |
73          aws s3 cp --acl public-read artifacts/android-shell-builder.tar.gz $S3_URI
74          echo "Release tarball uploaded to $S3_URI"
75          echo "You can deploy this by updating or creating a new file in https://github.com/expo/turtle/tree/master/shellTarballs/android"
76          echo "Then follow the deployment instructions: https://github.com/expo/turtle-deploy"
77      - name: ��️ Set the description for Slack message
78        if: ${{ github.event_name != 'push' }}
79        run: |
80          if [ ${{ github.event_name }} == 'schedule' ]; then
81            echo "SLACK_MESSAGE_DESCRIPTION=scheduled" >> $GITHUB_ENV
82          else
83            echo "SLACK_MESSAGE_DESCRIPTION=triggered by ${{ github.actor }}" >> $GITHUB_ENV
84          fi
85      - name: �� Notify on Slack
86        uses: 8398a7/action-slack@v3
87        if: ${{ github.event_name != 'push' }}
88        env:
89          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90          SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_ANDROID }}
91          MATRIX_CONTEXT: ${{ toJson(matrix) }}
92        with:
93          channel: '#expo-android'
94          status: ${{ job.status }}
95          fields: job,message,ref,eventName,author,took
96          author_name: Android Shell App (${{ env.SLACK_MESSAGE_DESCRIPTION }})
97