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