2
2
name : Package SDKs
3
3
4
4
on :
5
+ workflow_call :
6
+ inputs :
7
+ triggered_by_callable :
8
+ description : ' Check if this package grabs artifacts from new build workflow'
9
+ default : false
10
+ required : true
11
+ type : boolean
12
+ skipIntegrationTests :
13
+ description : ' skip integration tests?'
14
+ default : ' 0'
15
+ required : false
16
+ type : string
17
+ create_new_branch :
18
+ description : ' Check if we need to create new branch to package guids update. If working_branch set, will ignore this value. '
19
+ default : ' 0'
20
+ required : false
21
+ type : string
22
+ working_branch :
23
+ description : ' If already a working in progress release branch'
24
+ required : false
25
+ type : string
26
+ release_label :
27
+ description : ' If the package is intended to run for a release, put <version>-RC## for label'
28
+ required : false
29
+ type : string
30
+ build_run_id :
31
+ description : ' run id for build_starter.yml, search for all output'
32
+ required : false
33
+ type : string
34
+
5
35
workflow_dispatch :
6
36
inputs :
7
37
use_new_build :
@@ -49,26 +79,58 @@ jobs:
49
79
runs-on : ubuntu-latest
50
80
strategy :
51
81
fail-fast : false
82
+ outputs :
83
+ skipIntegrationTests : ${{ steps.decide_input.outputs.skipIntegrationTests }}
52
84
steps :
53
- - name : Print out inputs
85
+ - name : Decide inputs
86
+ id : decide_input
54
87
shell : bash
55
88
run : |
56
- echo use_new_build: ${{ github.event.inputs.use_new_build }}
57
- echo skipIntegrationTests: ${{ github.event.inputs.skipIntegrationTests }}
58
- echo create_new_branch: ${{ github.event.inputs.create_new_branch }}
59
- echo release_label: ${{ github.event.inputs.release_label }}
60
- echo working_branch: ${{ github.event.inputs.working_branch }}
61
- echo download_ios_run: ${{ github.event.inputs.download_ios_run }}
62
- echo download_android_run: ${{ github.event.inputs.download_android_run }}
63
- echo download_linux_run: ${{ github.event.inputs.download_linux_run }}
64
- echo download_macos_run: ${{ github.event.inputs.download_macos_run }}
65
- echo download_windows_run: ${{ github.event.inputs.download_windows_run }}
89
+ if [[ "${{ inputs.triggered_by_callable }}" == "true" ]]; then
90
+ # Triggered by callable
91
+ echo "::set-output name=use_new_build::'1'"
92
+ echo "::set-output name=skipIntegrationTests::${{ inputs.skipIntegrationTests }}"
93
+ echo "::set-output name=create_new_branch::${{ inputs.create_new_branch }}"
94
+ echo "::set-output name=release_label::${{ inputs.release_label }}"
95
+ echo "::set-output name=working_branch::${{ inputs.working_branch }}"
96
+ echo "::set-output name=download_android_run::${{ inputs.build_run_id }}"
97
+ echo "::set-output name=download_ios_run::${{ inputs.build_run_id }}"
98
+ echo "::set-output name=download_linux_run::${{ inputs.build_run_id }}"
99
+ echo "::set-output name=download_macos_run::${{ inputs.build_run_id }}"
100
+ echo "::set-output name=download_windows_run::${{ inputs.build_run_id }}"
101
+ else
102
+ echo "::set-output name=use_new_build::${{ github.event.inputs.use_new_build }}"
103
+ echo "::set-output name=skipIntegrationTests::${{ github.event.inputs.skipIntegrationTests }}"
104
+ echo "::set-output name=create_new_branch::${{ github.event.inputs.create_new_branch }}"
105
+ echo "::set-output name=release_label::${{ github.event.inputs.release_label }}"
106
+ echo "::set-output name=working_branch::${{ github.event.inputs.working_branch }}"
107
+ echo "::set-output name=download_android_run::${{ github.event.inputs.download_android_run }}"
108
+ echo "::set-output name=download_ios_run::${{ github.event.inputs.download_ios_run }}"
109
+ echo "::set-output name=download_linux_run::${{ github.event.inputs.download_linux_run }}"
110
+ echo "::set-output name=download_macos_run::${{ github.event.inputs.download_macos_run }}"
111
+ echo "::set-output name=download_windows_run::${{ github.event.inputs.download_windows_run }}"
112
+ fi
113
+
114
+ - name : Print inputs
115
+ shell : bash
116
+ run : |
117
+ echo triggered_by_callable: ${{ inputs.triggered_by_callable }}
118
+ echo use_new_build: ${{ steps.decide_input.outputs.use_new_build }}
119
+ echo skipIntegrationTests: ${{ steps.decide_input.outputs.skipIntegrationTests }}
120
+ echo create_new_branch: ${{ steps.decide_input.outputs.create_new_branch }}
121
+ echo release_label: ${{ steps.decide_input.outputs.release_label }}
122
+ echo working_branch: ${{ steps.decide_input.outputs.working_branch }}
123
+ echo download_android_run: ${{ steps.decide_input.outputs.download_android_run }}
124
+ echo download_ios_run: ${{ steps.decide_input.outputs.download_ios_run }}
125
+ echo download_linux_run: ${{ steps.decide_input.outputs.download_linux_run }}
126
+ echo download_macos_run: ${{ steps.decide_input.outputs.download_macos_run }}
127
+ echo download_windows_run: ${{ steps.decide_input.outputs.download_windows_run }}
66
128
67
129
- name : Check out base branch
68
130
69
131
with :
70
132
fetch-depth : 0
71
- ref : ${{ github.event.inputs .working_branch }}
133
+ ref : ${{ steps.decide_input.outputs .working_branch }}
72
134
73
135
- name : Setup Python
74
136
uses : actions/setup-python@v2
@@ -80,32 +142,45 @@ jobs:
80
142
run : |
81
143
pip install -r scripts/gha/requirements.txt
82
144
145
+ - name : Generate token for GitHub API
146
+ # This step is necessary because the existing GITHUB_TOKEN cannot be used inside one workflow to trigger another.
147
+ #
148
+ # Instead, generate a new token here, using our GitHub App's private key and App ID (saved as Secrets).
149
+ #
150
+ # This method is preferred over the "personal access token" solution, as the GitHub App's scope is limited to just
151
+ # the firebase-cpp-sdk repository.
152
+ uses : tibdex/github-app-token@v1
153
+ id : generate-token
154
+ with :
155
+ app_id : ${{ secrets.WORKFLOW_TRIGGER_APP_ID }}
156
+ private_key : ${{ secrets.WORKFLOW_TRIGGER_APP_PRIVATE_KEY }}
157
+
83
158
- name : Name new branch
84
- if : github.event.inputs .working_branch == '' && github.event.inputs .create_new_branch == '1'
159
+ if : steps.decide_input.outputs .working_branch == '' && steps.decide_input.outputs .create_new_branch == '1'
85
160
run : |
86
161
date_str=$(date "+%Y%m%d-%H%M%S")
87
162
echo "NEW_BRANCH=new_branch-${date_str}" >> $GITHUB_ENV
88
163
89
164
- name : Create new branch
90
- if : github.event.inputs .working_branch == '' && github.event.inputs .create_new_branch == '1'
165
+ if : steps.decide_input.outputs .working_branch == '' && steps.decide_input.outputs .create_new_branch == '1'
91
166
run : |
92
167
git remote update
93
168
git checkout -b "${NEW_BRANCH}"
94
169
echo "UPDATE_LOGFILE=update_log.txt" >> $GITHUB_ENV
95
170
96
171
- name : Checkout working branch
97
- if : github.event.inputs .working_branch != ''
172
+ if : steps.decide_input.outputs .working_branch != ''
98
173
run : |
99
174
git remote update
100
- git checkout ${{ github.event.inputs .working_branch }}
175
+ git checkout ${{ steps.decide_input.outputs .working_branch }}
101
176
echo "UPDATE_LOGFILE=update_log.txt" >> $GITHUB_ENV
102
- echo "NEW_BRANCH=${{ github.event.inputs .working_branch }}" >> $GITHUB_ENV
177
+ echo "NEW_BRANCH=${{ steps.decide_input.outputs .working_branch }}" >> $GITHUB_ENV
103
178
104
179
- name : Set Fetch Workflow name
105
180
id : set-fetch-workflow
106
181
shell : bash
107
182
run : |
108
- if [[ "${{ github.event.inputs .use_new_build }}" == "1" ]]; then
183
+ if [[ "${{ steps.decide_input.outputs .use_new_build }}" == "1" ]]; then
109
184
# all use build_starter.yml
110
185
echo "::set-output name=android_yml::'build_starter.yml'"
111
186
echo "::set-output name=ios_yml::'build_starter.yml'"
@@ -125,7 +200,7 @@ jobs:
125
200
continue-on-error : true
126
201
with :
127
202
workflow : ${{ steps.set-fetch-workflow.outputs.android_yml }}
128
- run_id : ${{ github.event.inputs .download_android_run }}
203
+ run_id : ${{ steps.decide_input.outputs .download_android_run }}
129
204
name : android_unity
130
205
path : built_artifect
131
206
@@ -134,7 +209,7 @@ jobs:
134
209
continue-on-error : true
135
210
with :
136
211
workflow : ${{ steps.set-fetch-workflow.outputs.ios_yml }}
137
- run_id : ${{ github.event.inputs .download_ios_run }}
212
+ run_id : ${{ steps.decide_input.outputs .download_ios_run }}
138
213
name : ios_unity
139
214
path : built_artifect
140
215
@@ -143,7 +218,7 @@ jobs:
143
218
continue-on-error : true
144
219
with :
145
220
workflow : ${{ steps.set-fetch-workflow.outputs.linux_yml }}
146
- run_id : ${{ github.event.inputs .download_linux_run }}
221
+ run_id : ${{ steps.decide_input.outputs .download_linux_run }}
147
222
name : linux_unity
148
223
path : built_artifect
149
224
@@ -152,7 +227,7 @@ jobs:
152
227
continue-on-error : true
153
228
with :
154
229
workflow : ${{ steps.set-fetch-workflow.outputs.macos_yml }}
155
- run_id : ${{ github.event.inputs .download_macos_run }}
230
+ run_id : ${{ steps.decide_input.outputs .download_macos_run }}
156
231
name : macos_unity
157
232
path : built_artifect
158
233
@@ -161,7 +236,7 @@ jobs:
161
236
continue-on-error : true
162
237
with :
163
238
workflow : ${{ steps.set-fetch-workflow.outputs.windows_yml }}
164
- run_id : ${{ github.event.inputs .download_windows_run }}
239
+ run_id : ${{ steps.decide_input.outputs .download_windows_run }}
165
240
name : windows_unity
166
241
path : built_artifect
167
242
@@ -197,7 +272,7 @@ jobs:
197
272
fi
198
273
199
274
- name : Create PR if there is None
200
- if : github.event.inputs .working_branch == '' && github.event.inputs .create_new_branch == '1'
275
+ if : steps.decide_input.outputs .working_branch == '' && steps.decide_input.outputs .create_new_branch == '1'
201
276
id : push-branch
202
277
run : |
203
278
if ! git update-index --refresh; then
@@ -287,7 +362,7 @@ jobs:
287
362
trigger_integration_tests :
288
363
# Trigger the integration_tests workflow.
289
364
needs : [package_sdks]
290
- if : (github.event.inputs .skipIntegrationTests == '0') && !cancelled() && !failure()
365
+ if : (needs.package_sdks.outputs .skipIntegrationTests == '0') && !cancelled() && !failure()
291
366
runs-on : ubuntu-latest
292
367
steps :
293
368
- name : Checkout repo
0 commit comments