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-18.04 18 steps: 19 - uses: actions/checkout@v3 20 with: 21 submodules: true 22 - name: Use JDK 11 23 uses: actions/setup-java@v3 24 with: 25 distribution: 'temurin' 26 java-version: '11' 27 - name: Get cache key of git lfs files 28 id: git-lfs 29 run: echo "::set-output name=sha256::$(git lfs ls-files | openssl dgst -sha256)" 30 - uses: actions/cache@v2 31 with: 32 path: .git/lfs 33 key: ${{ steps.git-lfs.outputs.sha256 }} 34 - run: git lfs pull 35 - run: echo "$(pwd)/bin" >> $GITHUB_PATH 36 - run: echo "EXPO_ROOT_DIR=$(pwd)" >> $GITHUB_ENV 37 - name: Get yarn cache directory path 38 id: yarn-cache-dir-path 39 run: echo "::set-output name=dir::$(yarn cache dir)" 40 - uses: actions/cache@v2 41 with: 42 path: ${{ steps.yarn-cache-dir-path.outputs.dir }} 43 key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }} 44 restore-keys: | 45 ${{ runner.os }}-yarn- 46 - run: yarn install --frozen-lockfile 47 - uses: actions/cache@v2 48 with: 49 path: ~/.gradle/caches 50 key: ${{ runner.os }}-gradle-${{ hashFiles('android/*.gradle*') }} 51 restore-keys: | 52 ${{ runner.os }}-gradle- 53 - uses: actions/cache@v2 54 id: cache-android-ndk 55 with: 56 path: /usr/local/lib/android/sdk/ndk/21.4.7075529/ 57 key: ${{ runner.os }}-ndk-21.4.7075529 58 restore-keys: | 59 ${{ runner.os }}-ndk- 60 - name: Install NDK 61 if: steps.cache-android-ndk.outputs.cache-hit != 'true' 62 run: | 63 sudo $ANDROID_SDK_ROOT/tools/bin/sdkmanager --install "ndk;21.4.7075529" 64 - name: Build Android packages 65 env: 66 ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/21.4.7075529/ 67 run: expotools android-build-packages --packages all 68 - name: Clean Android build artifacts that would needlessly bloat the shell app 69 env: 70 ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/21.4.7075529/ 71 run: ./gradlew clean 72 working-directory: android 73 - name: Build shell app tarball 74 run: ./buildAndroidTarballLocally.sh 75 - name: Make an artifact 76 uses: actions/upload-artifact@v3 77 with: 78 name: android-shell-app 79 path: artifacts/android-shell-builder.tar.gz 80 - name: Upload shell app tarball to S3 81 if: ${{ github.event_name == 'workflow_dispatch' }} 82 env: 83 AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} 84 AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} 85 S3_URI: s3://exp-artifacts/android-shell-builder-${{ github.sha }}.tar.gz 86 run: | 87 aws s3 cp --acl public-read artifacts/android-shell-builder.tar.gz $S3_URI 88 echo "Release tarball uploaded to $S3_URI" 89 echo "You can deploy this by updating or creating a new file in https://github.com/expo/turtle/tree/master/shellTarballs/android" 90 echo "Then follow the deployment instructions: https://github.com/expo/turtle-deploy" 91 - name: Set the description for slack message 92 if: ${{ github.event_name != 'push' }} 93 run: | 94 if [ ${{ github.event_name }} == 'schedule' ]; then 95 echo "SLACK_MESSAGE_DESCRIPTION=scheduled" >> $GITHUB_ENV 96 else 97 echo "SLACK_MESSAGE_DESCRIPTION=triggered by ${{ github.actor }}" >> $GITHUB_ENV 98 fi 99 - uses: 8398a7/action-slack@v3 100 if: ${{ github.event_name != 'push' }} 101 env: 102 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 103 SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_ANDROID }} 104 with: 105 channel: '#expo-android' 106 status: ${{ job.status }} 107 fields: job,message,ref,eventName,author,took 108 author_name: Android Shell App (${{ env.SLACK_MESSAGE_DESCRIPTION }}) 109