xref: /expo/.github/workflows/client-ios-eas.yml (revision eea2febf)
1name: iOS 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-signed
14          - versioned-client-add-sdk
15  schedule:
16    # 5:20 AM UTC time on every Monday, Wednesday and Friday
17    # Build a versioned client
18    - cron: '20 5 * * 1,3,5'
19    # 5:20 AM UTC time on every Monday
20    # Run versioning process for the next sdk and build a versioned client
21    - cron: '20 5 * * 1'
22  pull_request:
23    paths:
24      - .github/workflows/client-ios-eas.yml
25      - apps/eas-expo-go/**
26      - ios/**
27      - tools/src/dynamic-macros/**
28      - tools/src/commands/IosGenerateDynamicMacros.ts
29      - tools/src/client-build/**
30      - tools/src/commands/ClientBuild.ts
31      - secrets/**
32      - fastlane/**
33      - Gemfile.lock
34      - .ruby-version
35      - yarn.lock
36  push:
37    branches: [main, sdk-*]
38    paths:
39      - .github/workflows/client-ios-eas.yml
40      - apps/eas-expo-go/**
41      - ios/**
42      - tools/src/dynamic-macros/**
43      - tools/src/commands/IosGenerateDynamicMacros.ts
44      - tools/src/client-build/**
45      - tools/src/commands/ClientBuild.ts
46      - secrets/**
47      - fastlane/**
48      - Gemfile.lock
49      - .ruby-version
50      - yarn.lock
51
52concurrency:
53  group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
54  cancel-in-progress: true
55
56jobs:
57  build:
58    runs-on: ubuntu-20.04
59    if: ${{ github.actor != 'dependabot[bot]' }}
60    steps:
61      - name: �� Checkout
62        uses: actions/checkout@v3
63        with:
64          submodules: true
65      - name: �� Decrypt secrets if possible
66        uses: ./.github/actions/expo-git-decrypt
67        with:
68          key: ${{ secrets.GIT_CRYPT_KEY_BASE64 }}
69      - name: ➕ Add `bin` to GITHUB_PATH
70        run: echo "$(pwd)/bin" >> $GITHUB_PATH
71      - name: ♻️ Restore caches
72        uses: ./.github/actions/expo-caches
73        id: expo-caches
74        with:
75          yarn-workspace: 'true'
76          yarn-tools: 'true'
77      - name: �� Yarn install
78        if: steps.expo-caches.outputs.yarn-workspace-hit != 'true'
79        run: yarn install --frozen-lockfile
80      - name: Install eas-cli
81        run: npm install -g eas-cli
82      - name: �� Check which flavor to build
83        id: flavor
84        uses: dorny/paths-filter@v2
85        with:
86          # this action fails when base is not set on schedule event
87          base: ${{ github.ref }}
88          filters: |
89            versioned:
90              - ios/versioned-react-native/**
91              - ios/Exponent/Versioned/**
92      - name: Resolve profile
93        id: profile
94        run: |
95          DISPATCH_PROFILE="${{ github.event.inputs.buildType }}"
96          IS_VERSIONED="${{ steps.flavor.outputs.versioned }}"
97          if [[ ! -z "$DISPATCH_PROFILE" ]]; then
98            echo "profile=$DISPATCH_PROFILE" >> $GITHUB_OUTPUT
99          elif [[ "${{ github.event.schedule }}" == "20 5 * * 1,3,5" ]]; then
100            echo "profile=versioned-client" >> $GITHUB_OUTPUT
101          elif [[ "${{ github.event.schedule }}" == "20 5 * * 1" ]]; then
102            echo "profile=versioned-client-add-sdk" >> $GITHUB_OUTPUT
103          elif [[ "$IS_VERSIONED" == "true" ]]; then
104            echo "profile=versioned-client" >> $GITHUB_OUTPUT
105          else
106            echo "profile=unversioned-client" >> $GITHUB_OUTPUT
107          fi
108      - name: Build
109        uses: ./.github/actions/eas-build
110        id: build
111        with:
112          platform: 'ios'
113          profile: ${{ steps.profile.outputs.profile  }}
114          projectRoot: './apps/eas-expo-go'
115          expoToken: ${{ secrets.EAS_BUILD_BOT_TOKEN }}
116          noWait: ${{ github.event.schedule }}
117          message: ${{ github.event.pull_request.title }}
118      - name: On workflow canceled
119        if: ${{ cancelled() && steps.build.outputs.build_id }}
120        run: eas build:cancel ${{ steps.build.outputs.build_id }}
121        working-directory: ./apps/eas-expo-go
122        env:
123          EXPO_TOKEN: ${{ secrets.EAS_BUILD_BOT_TOKEN }}
124          EAS_BUILD_PROFILE: ${{ steps.profile.outputs.profile  }}
125