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