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