1name: Android Shell App
2
3on:
4  workflow_dispatch:
5    inputs:
6      releaseShellAndroid:
7        description: 'type "release-shell-android" to confirm upload'
8        required: false
9  schedule:
10    - cron: '20 5 * * 2,4,6' # 5:20 AM UTC time on every Tuesday, Thursday and Saturday
11  push:
12    paths:
13      - .github/workflows/shell-app-android.yml
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      - name: Set up bin paths and env
29        run: |
30          echo "::add-path::$(pwd)/bin"
31          echo "::set-env name=EXPO_ROOT_DIR::$(pwd)"
32      - run: sudo apt-get install awscli
33      - name: Check that Android packages are up-to-date
34        if: ${{ github.event_name == 'workflow_dispatch' }}
35        run: expotools check-android-packages
36      - name: Build shell app tarball
37        run: ./buildAndroidTarballLocally.sh
38      - name: Make an artifact
39        uses: actions/upload-artifact@v2
40        with:
41          name: android-shell-app
42          path: artifacts/android-shell-builder.tar.gz
43      - name: Upload shell app tarball to S3
44        if: ${{ github.event_name == 'workflow_dispatch' }}
45        env:
46          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
47          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
48          S3_URI: s3://exp-artifacts/android-shell-builder-${{ github.sha }}.tar.gz
49        run: |
50          aws s3 cp --acl public-read artifacts/android-shell-builder.tar.gz $S3_URI
51          echo "Release tarball uploaded to $S3_URI"
52          echo "You can deploy this by updating or creating a new file in https://github.com/expo/turtle/tree/master/shellTarballs/android"
53          echo "Then follow the deployment instructions: https://github.com/expo/turtle-deploy"
54      - name: Set the description for slack message
55        if: ${{ github.event_name != 'push' }}
56        run: |
57          if [ ${{ github.event_name }} == 'schedule' ]; then
58            echo "::set-env name=SLACK_MESSAGE_DESCRIPTION::scheduled"
59          else
60            echo "::set-env name=SLACK_MESSAGE_DESCRIPTION::triggered by ${{ github.actor }}"
61          fi
62      - uses: 8398a7/action-slack@v3
63        if: ${{ github.event_name != 'push' }}
64        env:
65          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66          SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_ANDROID }}
67        with:
68          channel: '#platform-android'
69          status: ${{ job.status }}
70          fields: job,commit,ref,eventName,author,took
71          author_name: Android Shell App (${{ env.SLACK_MESSAGE_DESCRIPTION }})
72