-
Notifications
You must be signed in to change notification settings - Fork 2
223 lines (199 loc) · 9.14 KB
/
Copy patheas-build-local.yml
File metadata and controls
223 lines (199 loc) · 9.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# This is a basic workflow to help you get started with Actions
name: EAS Build Local
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
workflow_call:
inputs:
working_directory:
type: string
default: .
description: The working directory to run the workflow in.
required: false
java_version:
type: string
description: The java version to use
required: false
default: "17"
xcode_version:
type: string
description: The xcode version to use
required: false
default: "latest-stable"
platform:
type: string
description: ios or android
required: true
expo_app_slug:
type: string
description: The expo app slug
required: false
expo_organisation_or_user_slug:
type: string
description: The organisation/user slug you're publishing to
required: false
default: kingstinct
build_profile:
type: string
description: The build profile to use, staging or production for example
required: true
always_run:
type: boolean
description: Run even if there's a build with the same hash (finished or in progress)
required: false
default: false
package_manager:
required: false
type: string
default: yarn
description: The package manager to use
autosubmit:
required: false
type: boolean
default: false
description: Autosubmit to AppStore/PlayStore
checkout_ref:
required: false
type: string
description: The ref to checkout
pnpm_version:
required: false
type: string
description: If using pnpm - which version to use (defaults to the packageManager field in package.json)
google_service_account_key_path:
required: false
type: string
default: ./google-service-account-key.json
description: The path to the google-service-account-key.json file
bun_version:
required: false
type: string
description: Set bun version
env_file:
required: false
type: string
description: The path to the env file
secrets:
EXPO_TOKEN:
description: The Expo token to use for publishing
required: true
EXPO_APPLE_APP_SPECIFIC_PASSWORD:
description: The Apple App Specific Password to use for publishing to AppStore (required for autosubmit)
required: false
GOOGLE_SERVICE_ACCOUNT_KEY_JSON:
description: The Google Services JSON to use for publishing to PlayStore (required for autosubmit)
required: false
SLACK_WEBHOOK:
description: The Slack Webhook to use for notifications
required: false
DISCORD_WEBHOOK:
description: The Discord Webhook to use for notifications
required: false
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
eas-build:
timeout-minutes: 60
runs-on: ${{ inputs.platform == 'android' && 'ubuntu-latest-8cores' || 'macos-latest-xl' }}
env:
EXPO_DEBUG: 1
DEBUG: 1
EAS_BUILD_AUTOCOMMIT: ${{ inputs.autosubmit }}
GOOGLE_SERVICE_ACCOUNT_KEY_JSON: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_KEY_JSON }}
EXPO_APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.EXPO_APPLE_APP_SPECIFIC_PASSWORD }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
if: ${{ !inputs.checkout_ref }}
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
if: ${{ inputs.checkout_ref }}
with:
ref: ${{ inputs.checkout_ref }}
- uses: cardinalby/export-env-action@4f48c4676cf6ed6f46e30899ee987ce695da7c80 # 2.2.3
if: ${{ inputs.env_file }}
with:
envFile: ${{ inputs.env_file }}
# as required by expo 50
- uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5.6.0
if: ${{ inputs.platform == 'android' }}
with:
distribution: zulu
java-version: ${{ inputs.java_version }}
- uses: maxim-lobanov/setup-xcode@ed7a3b1fda3918c0306d1b724322adc0b8cc0a90 # v1.7.0
if: ${{ inputs.platform == 'ios' }}
with:
xcode-version: ${{ inputs.xcode_version || 'latest-stable'}}
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
if: ${{ inputs.package_manager == 'pnpm' }}
with:
version: ${{ inputs.pnpm_version }}
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
if: ${{ inputs.package_manager == 'bun' }}
with:
bun-version: ${{ inputs.bun_version || env.BUN_VERSION || 'latest'}}
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
if: ${{ inputs.package_manager != 'bun' }}
with:
node-version-file: .nvmrc
cache: ${{ inputs.package_manager }}
- name: Install dependencies (bun)
run: ${{ inputs.package_manager }} install --frozen-lockfile
if: ${{ inputs.package_manager == 'bun' }}
working-directory: ${{ inputs.working_directory }}
- name: Install dependencies (npm)
run: npm ci
if: ${{ inputs.package_manager == 'npm' }}
working-directory: ${{ inputs.working_directory }}
- name: Install dependencies (others)
run: ${{ inputs.package_manager }} install --frozen-lockfile
if: ${{ inputs.package_manager != 'npm' && inputs.package_manager != 'bun' }}
working-directory: ${{ inputs.working_directory }}
- name: Expo GitHub Action
uses: expo/expo-github-action@eab7a230208c952974db8c3245cfd78402c7b385 # 9.0.0
id: expo-init
with:
# Your Expo username, for authentication.
token: ${{ secrets.EXPO_TOKEN }}
# If Expo should be stored in the GitHub Actions cache (can be true or false)
expo-version: latest
eas-version: latest
packager: ${{ inputs.package_manager }}
expo-cache: true # optional
- name: Get Hash
if: ${{ !inputs.always_run }}
run: echo "HASH=`jq -r '.expo.${{ inputs.platform }}.runtimeVersion' app.json`" >> $GITHUB_ENV
working-directory: ${{ inputs.working_directory }}
- name: create google-services.json
id: init-google-services-json
if: ${{ inputs.platform == 'android' && inputs.autosubmit && env.GOOGLE_SERVICE_ACCOUNT_KEY_JSON }}
run: echo "${{ secrets.GOOGLE_SERVICE_ACCOUNT_KEY_JSON }}" > ${{ inputs.google_service_account_key_path }}
- name: EAS Build
if: ${{ inputs.autosubmit && (inputs.always_run || (env.MATCHING_IN_PROGRESS_BUILDS == 0 && env.MATCHING_FINISHED_BUILDS == 0 && env.MATCHING_IN_QUEUE_BUILDS == 0 && env.MATCHING_NEW_BUILDS == 0)) }}
run: |
BUILD_ID=`set -e; npx eas-cli@latest build --no-wait --non-interactive --profile=${{ inputs.build_profile }} --auto-submit --platform ${{ inputs.platform }} --local --json | jq ".[].id"`
echo "BUILD_ID=${BUILD_ID}" >> $GITHUB_ENV
working-directory: ${{ inputs.working_directory }}
- name: EAS Build
if: ${{ !inputs.autosubmit && (inputs.always_run || (env.MATCHING_IN_PROGRESS_BUILDS == 0 && env.MATCHING_FINISHED_BUILDS == 0 && env.MATCHING_IN_QUEUE_BUILDS == 0 && env.MATCHING_NEW_BUILDS == 0)) }}
run: |
BUILD_ID=`set -e; npx eas-cli@latest build --no-wait --non-interactive --profile=${{ inputs.build_profile }} --platform ${{ inputs.platform }} --local --json | jq ".[].id"`
echo "BUILD_ID=${BUILD_ID}" >> $GITHUB_ENV
working-directory: ${{ inputs.working_directory }}
- run: echo "::set-output name=BUILD_URL::https://expo.dev/accounts/${{ inputs.expo_organisation_or_user_slug }}/projects/${{ inputs.expo_app_slug }}/builds/${{ env.BUILD_ID }}"
id: build-url-with-app-slug
if: ${{ env.BUILD_ID && inputs.expo_app_slug }}
- run: echo "::set-output name=BUILD_URL::https://expo.dev/accounts/${{ inputs.expo_organisation_or_user_slug }}"
id: build-url
if: ${{ env.BUILD_ID && !inputs.expo_app_slug }}
- name: Fail if no build was created when expected
run: exit 1
if: ${{ !env.BUILD_ID && ((env.MATCHING_IN_PROGRESS_BUILDS == 0 && env.MATCHING_FINISHED_BUILDS == 0 && env.MATCHING_IN_QUEUE_BUILDS == 0 && env.MATCHING_NEW_BUILDS == 0) || inputs.always_run) }}
- uses: sarisia/actions-status-discord@eb045afee445dc055c18d3d90bd0f244fd062708 # v1.16.0
if: ${{ failure() && env.DISCORD_WEBHOOK }}
with:
webhook: ${{ env.DISCORD_WEBHOOK }}
url: ${{ env.BUILD_URL }}
- uses: rtCamp/action-slack-notify@33ca3be66c6f378fe1610fd1d5258632dbed5e58 # v2.4.0
if: ${{ failure() && env.SLACK_WEBHOOK }}