-
Notifications
You must be signed in to change notification settings - Fork 1
166 lines (142 loc) · 6.07 KB
/
build_and_run_sherlo.yml
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
name: Build Example Apps & Run Sherlo
# Trigger the workflow on push to the 'dev' branch and pull request labeled 'sherlo' targeting 'dev' branch
on:
push:
branches:
- dev
# temp
- michal/add-optional-cli-path-arguments
pull_request:
branches:
- dev
types: [labeled]
paths-ignore:
- '**/*'
jobs:
android_preview_build:
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && (contains(github.event.pull_request.labels.*.name, 'sherlo') || contains(github.event.pull_request.labels.*.name, 'sherlo:skip_build'))) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Set up Node.js
if: ${{ !contains(join(github.event.pull_request.labels.*.name), 'sherlo:skip_build') }}
uses: actions/setup-node@v2
with:
node-version: '18.18.0'
- name: Setup Java Environment
if: ${{ !contains(join(github.event.pull_request.labels.*.name), 'sherlo:skip_build') }}
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
- name: Install dependencies
if: ${{ !contains(join(github.event.pull_request.labels.*.name), 'sherlo:skip_build') }}
run: yarn
- name: Build dependencies
if: ${{ !contains(join(github.event.pull_request.labels.*.name), 'sherlo:skip_build') }}
run: yarn build
- name: Setup EAS
if: ${{ !contains(join(github.event.pull_request.labels.*.name), 'sherlo:skip_build') }}
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: Build Android example app
if: ${{ !contains(join(github.event.pull_request.labels.*.name), 'sherlo:skip_build') }}
run: yarn workspace @sherlo/expo-example android:build:preview
- name: Upload Android Artifact
uses: actions/upload-artifact@v2
with:
name: android-preview
path: examples/expo-example/builds/preview/android.apk
ios_preview_build:
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && (contains(github.event.pull_request.labels.*.name, 'sherlo') || contains(github.event.pull_request.labels.*.name, 'sherlo:skip_build'))) }}
runs-on: macos-13
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Set up Node.js
if: ${{ !contains(join(github.event.pull_request.labels.*.name), 'sherlo:skip_build') }}
uses: actions/setup-node@v2
with:
node-version: '18.18.0'
- name: Select Xcode Version
if: ${{ !contains(join(github.event.pull_request.labels.*.name), 'sherlo:skip_build') }}
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.0.1'
- run: |
xcode-select -print-path
- run: |
xcodebuild -version
- name: Setup Cocoapods
if: ${{ !contains(join(github.event.pull_request.labels.*.name), 'sherlo:skip_build') }}
uses: maxim-lobanov/setup-cocoapods@v1
with:
version: latest
- name: Install dependencies
if: ${{ !contains(join(github.event.pull_request.labels.*.name), 'sherlo:skip_build') }}
run: yarn
- name: Build dependencies
if: ${{ !contains(join(github.event.pull_request.labels.*.name), 'sherlo:skip_build') }}
run: yarn build
- name: Setup EAS
if: ${{ !contains(join(github.event.pull_request.labels.*.name), 'sherlo:skip_build') }}
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: Build iOS example app
if: ${{ !contains(join(github.event.pull_request.labels.*.name), 'sherlo:skip_build') }}
run: yarn workspace @sherlo/expo-example ios:build:preview
- name: Upload iOS Artifact
uses: actions/upload-artifact@v2
with:
name: ios-preview
path: examples/expo-example/builds/preview/ios.tar.gz
run_sherlo_action:
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && (contains(github.event.pull_request.labels.*.name, 'sherlo') || contains(github.event.pull_request.labels.*.name, 'sherlo:skip_build'))) }}
runs-on: ubuntu-latest
needs: [android_preview_build, ios_preview_build]
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Download Android Artifact
uses: actions/download-artifact@v2
with:
name: android-preview
path: examples/expo-example/builds/preview
- name: Download iOS Artifact
uses: actions/download-artifact@v2
with:
name: ios-preview
path: examples/expo-example/builds/preview
- name: Create GH App Token
id: github_app_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.SHERLO_BOT_APP_ID }}
private_key: ${{ secrets.SHERLO_BOT_PRIVATE_KEY }}
- name: Commit and push Preview builds
if: ${{ !contains(join(github.event.pull_request.labels.*.name), 'sherlo:skip_build') }}
env:
BRANCH_NAME: ${{ github.event_name == 'pull_request' && github.head_ref || format('refs/heads/{0}', github.ref_name) }}
GITHUB_APP_TOKEN: ${{ steps.github_app_token.outputs.token }}
run: |
git config --global user.name 'Sherlo Bot'
git config --global user.email '[email protected]'
git add examples/expo-example/builds/preview
git commit -m "Update Preview builds"
git -c http.https://github.com/.extraheader="AUTHORIZATION: bearer ${GITHUB_APP_TOKEN}" push origin "${BRANCH_NAME}"
- name: Run Sherlo Action
uses: ./.
with:
ios: examples/expo-example/builds/preview/ios.tar.gz
android: examples/expo-example/builds/preview/android.apk
config: examples/expo-example/sherlo.config.json
env:
SHERLO_TOKEN: ${{ secrets.SHERLO_TOKEN }}