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