Skip to content

Commit 1ce13e7

Browse files
authored
Make one workflow to create release (#340)
1 parent eb11b69 commit 1ce13e7

File tree

3 files changed

+210
-82
lines changed

3 files changed

+210
-82
lines changed

.github/workflows/build_starter.yml

Lines changed: 51 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
default: '2019'
1313
required: true
1414
firebase_cpp_sdk_version:
15-
description: 'Firebase CPP SDK version to build against (The branch, tag or SHA to checkout)'
15+
description: 'Firebase CPP SDK version to build against (The branch, tag or SHA to checkout). Required if for release'
1616
default: ''
1717
required: false
1818
unity_branch:
@@ -32,9 +32,14 @@ on:
3232
description: 'Additional flags to pass into CMake'
3333
default: ''
3434
required: false
35-
release_label:
36-
description: 'If the package is intended to run for a release, put <version>-RC## for label'
37-
default: 'NoneRelease'
35+
release_version:
36+
description: 'If the package is intended to run for a release, put <version> number like 9.1.0'
37+
default: 'NoVersion'
38+
type: string
39+
required: true
40+
rc_index:
41+
description: 'If the package is intended to run for a release, put RC## for label'
42+
default: 'NA'
3843
type: string
3944
required: true
4045
should_trigger_package:
@@ -55,6 +60,7 @@ jobs:
5560
runs-on: ubuntu-latest
5661
outputs:
5762
platform: ${{ steps.set_outputs.outputs.platform }}
63+
release_label: ${{ steps.set_outputs.outputs.release_label }}
5864
steps:
5965
- uses: actions/checkout@v2
6066
with:
@@ -69,52 +75,79 @@ jobs:
6975
run: pip install -r scripts/gha/requirements.txt
7076
- id: set_outputs
7177
run: |
72-
platform=$( python scripts/gha/print_matrix_configuration.py -c -w build_unity_sdks -k platform -o "${{github.event.inputs.platforms}}" )
78+
platform=$( python scripts/gha/print_matrix_configuration.py -c -w build_unity_sdks -k platform -o "${{ github.event.inputs.platforms }}" )
7379
echo "::set-output name=platform::${platform}"
80+
echo "::set-output name=release_label::${{ github.event.inputs.release_version }}-${{ github.event.inputs.rc_index }}"
81+
82+
update_versions:
83+
uses: ./.github/workflows/update_versions.yml
84+
needs: check_and_prepare
85+
if: (github.event.inputs.release_version!='NoVersion')
86+
with:
87+
triggered_by_callable: true
88+
base_branch: ${{ github.event.inputs.unity_branch }}
89+
package_version_number: ${{ github.event.inputs.release_version }}
90+
cpp_release_version: ${{ github.event.inputs.firebase_cpp_sdk_version }}
91+
secrets: inherit
92+
93+
decide_build_branch:
94+
needs: update_versions
95+
runs-on: ubuntu-latest
96+
outputs:
97+
build_branch: ${{ steps.decide_branch.outputs.branch }}
98+
steps:
99+
- id: decide_branch
100+
run: |
101+
if [[ "${{ github.event.inputs.release_version }}" == "'NoVersion'" ]]; then
102+
# Triggered by callable
103+
echo "::set-output name=branch::${{ github.event.inputs.unity_branch }}"
104+
else
105+
echo "::set-output name=branch::${{ needs.update_versions.outputs.new_branch }}"
106+
fi
74107
75108
build_android:
76109
name: build-android-unity${{ github.event.inputs.unity_version }}-CPP${{ github.event.inputs.firebase_cpp_sdk_version }}
77110
uses: ./.github/workflows/build_android.yml
78-
needs: check_and_prepare
111+
needs: [check_and_prepare, decide_build_branch]
79112
if: contains(needs.check_and_prepare.outputs.platform, 'Android')
80113
with:
81114
unity_version: ${{ github.event.inputs.unity_version }}
82115
firebase_cpp_sdk_version: ${{ github.event.inputs.firebase_cpp_sdk_version }}
83-
unity_branch: ${{ github.event.inputs.unity_branch }}
116+
unity_branch: ${{ needs.decide_build_branch.outputs.build_branch }}
84117
apis: ${{ github.event.inputs.apis }}
85118
unity_platform_name: Android
86119
additional_cmake_flags: ${{ github.event.inputs.additional_cmake_flags }}
87120

88121
build_ios:
89122
name: build-ios-unity${{ github.event.inputs.unity_version }}-CPP${{ github.event.inputs.firebase_cpp_sdk_version }}
90123
uses: ./.github/workflows/build_ios.yml
91-
needs: check_and_prepare
124+
needs: [check_and_prepare, decide_build_branch]
92125
if: contains(needs.check_and_prepare.outputs.platform, 'iOS')
93126
with:
94127
unity_version: ${{ github.event.inputs.unity_version }}
95128
firebase_cpp_sdk_version: ${{ github.event.inputs.firebase_cpp_sdk_version }}
96-
unity_branch: ${{ github.event.inputs.unity_branch }}
129+
unity_branch: ${{ needs.decide_build_branch.outputs.build_branch }}
97130
apis: ${{ github.event.inputs.apis }}
98131
unity_platform_name: iOS
99132
additional_cmake_flags: ${{ github.event.inputs.additional_cmake_flags }}
100133

101134
build_linux:
102135
name: build-linux-unity${{ github.event.inputs.unity_version }}-CPP${{ github.event.inputs.firebase_cpp_sdk_version }}
103136
uses: ./.github/workflows/build_linux.yml
104-
needs: check_and_prepare
137+
needs: [check_and_prepare, decide_build_branch]
105138
if: contains(needs.check_and_prepare.outputs.platform, 'Linux')
106139
with:
107140
unity_version: ${{ github.event.inputs.unity_version }}
108141
firebase_cpp_sdk_version: ${{ github.event.inputs.firebase_cpp_sdk_version }}
109-
unity_branch: ${{ github.event.inputs.unity_branch }}
142+
unity_branch: ${{ needs.decide_build_branch.outputs.build_branch }}
110143
apis: ${{ github.event.inputs.apis }}
111144
unity_platform_name: Linux
112145
additional_cmake_flags: ${{ github.event.inputs.additional_cmake_flags }}
113146

114147
build_macos:
115148
name: build-macos-unity${{ github.event.inputs.unity_version }}-CPP${{ github.event.inputs.firebase_cpp_sdk_version }}
116149
uses: ./.github/workflows/build_macos.yml
117-
needs: check_and_prepare
150+
needs: [check_and_prepare, decide_build_branch]
118151
if: contains(needs.check_and_prepare.outputs.platform, 'macOS')
119152
with:
120153
unity_version: ${{ github.event.inputs.unity_version }}
@@ -127,24 +160,25 @@ jobs:
127160
build_windows:
128161
name: build-windows-unity${{ github.event.inputs.unity_version }}-CPP${{ github.event.inputs.firebase_cpp_sdk_version }}
129162
uses: ./.github/workflows/build_windows.yml
130-
needs: check_and_prepare
163+
needs: [check_and_prepare, decide_build_branch]
131164
if: contains(needs.check_and_prepare.outputs.platform, 'Windows')
132165
with:
133166
unity_version: ${{ github.event.inputs.unity_version }}
134167
firebase_cpp_sdk_version: ${{ github.event.inputs.firebase_cpp_sdk_version }}
135-
unity_branch: ${{ github.event.inputs.unity_branch }}
168+
unity_branch: ${{ needs.decide_build_branch.outputs.build_branch }}
136169
apis: ${{ github.event.inputs.apis }}
137170
unity_platform_name: Windows
138171
additional_cmake_flags: ${{ github.event.inputs.additional_cmake_flags }}
139172

140173
trigger_reusable_package:
141-
name: package ${{ github.event.inputs.release_label }}
142-
needs: [build_android, build_ios, build_linux, build_macos, build_windows]
174+
name: package ${{ needs.check_and_prepare.outputs.release_label }}
175+
needs: [build_android, build_ios, build_linux, build_macos, build_windows, decide_build_branch]
143176
uses: ./.github/workflows/package.yml
144177
if: (github.event.inputs.should_trigger_package == 'true') && !cancelled() && !failure()
145178
with:
146179
triggered_by_callable: true
147-
release_label: ${{ github.event.inputs.release_label }}
180+
release_label: ${{ needs.check_and_prepare.outputs.release_label }}
148181
skipIntegrationTests: ${{ github.event.inputs.skipIntegrationTests }}
149182
build_run_id: ${{ github.run_id }}
183+
working_branch: ${{ needs.decide_build_branch.outputs.build_branch }}
150184
secrets: inherit

.github/workflows/package.yml

Lines changed: 83 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ jobs:
8989
if [[ "${{ inputs.triggered_by_callable }}" == "true" ]]; then
9090
# Triggered by callable
9191
echo "::set-output name=use_new_build::'1'"
92+
echo "::set-output name=workflow_conclusion::in_progress"
9293
echo "::set-output name=skipIntegrationTests::${{ inputs.skipIntegrationTests }}"
9394
echo "::set-output name=create_new_branch::${{ inputs.create_new_branch }}"
9495
echo "::set-output name=release_label::${{ inputs.release_label }}"
@@ -100,6 +101,7 @@ jobs:
100101
echo "::set-output name=download_windows_run::${{ inputs.build_run_id }}"
101102
else
102103
echo "::set-output name=use_new_build::${{ github.event.inputs.use_new_build }}"
104+
echo "::set-output name=workflow_conclusion::success"
103105
echo "::set-output name=skipIntegrationTests::${{ github.event.inputs.skipIntegrationTests }}"
104106
echo "::set-output name=create_new_branch::${{ github.event.inputs.create_new_branch }}"
105107
echo "::set-output name=release_label::${{ github.event.inputs.release_label }}"
@@ -116,6 +118,7 @@ jobs:
116118
run: |
117119
echo triggered_by_callable: ${{ inputs.triggered_by_callable }}
118120
echo use_new_build: ${{ steps.decide_input.outputs.use_new_build }}
121+
echo workflow_conclusion: ${{ steps.decide_input.outputs.workflow_conclusion }}
119122
echo skipIntegrationTests: ${{ steps.decide_input.outputs.skipIntegrationTests }}
120123
echo create_new_branch: ${{ steps.decide_input.outputs.create_new_branch }}
121124
echo release_label: ${{ steps.decide_input.outputs.release_label }}
@@ -175,74 +178,117 @@ jobs:
175178
git checkout ${{ steps.decide_input.outputs.working_branch }}
176179
echo "UPDATE_LOGFILE=update_log.txt" >> $GITHUB_ENV
177180
echo "NEW_BRANCH=${{ steps.decide_input.outputs.working_branch }}" >> $GITHUB_ENV
178-
179-
- name: Set Fetch Workflow name
180-
id: set-fetch-workflow
181-
shell: bash
182-
run: |
183-
if [[ "${{ steps.decide_input.outputs.use_new_build }}" == "1" ]]; then
184-
# all use build_starter.yml
185-
echo "::set-output name=android_yml::'build_starter.yml'"
186-
echo "::set-output name=ios_yml::'build_starter.yml'"
187-
echo "::set-output name=linux_yml::'build_starter.yml'"
188-
echo "::set-output name=macos_yml::'build_starter.yml'"
189-
echo "::set-output name=windows_yml::'build_starter.yml'"
190-
else
191-
echo "::set-output name=android_yml::'android.yml'"
192-
echo "::set-output name=ios_yml::'ios.yml'"
193-
echo "::set-output name=linux_yml::'sdk_build.yml'"
194-
echo "::set-output name=macos_yml::'sdk_build.yml'"
195-
echo "::set-output name=windows_yml::'sdk_build.yml'"
196-
fi
197181
198-
- name: Fetch Android Artifacts
182+
- name: Fetch Android Artifacts (OLD)
199183
uses: dawidd6/action-download-artifact@v2
200184
continue-on-error: true
185+
if: (inputs.triggered_by_callable==false) && (steps.decide_input.outputs.use_new_build=='0')
201186
with:
202-
workflow: ${{ steps.set-fetch-workflow.outputs.android_yml }}
187+
workflow: android.yml
203188
run_id: ${{ steps.decide_input.outputs.download_android_run }}
204189
name: android_unity
205-
path: built_artifect
190+
path: built_artifact
206191

207-
- name: Fetch iOS Artifacts
192+
- name: Fetch iOS Artifacts (OLD)
208193
uses: dawidd6/action-download-artifact@v2
209194
continue-on-error: true
195+
if: (inputs.triggered_by_callable==false) && (steps.decide_input.outputs.use_new_build=='0')
210196
with:
211-
workflow: ${{ steps.set-fetch-workflow.outputs.ios_yml }}
197+
workflow: ios.yml
212198
run_id: ${{ steps.decide_input.outputs.download_ios_run }}
213199
name: ios_unity
214-
path: built_artifect
200+
path: built_artifact
215201

216-
- name: Fetch Linux Artifacts
202+
- name: Fetch Linux Artifacts (OLD)
217203
uses: dawidd6/action-download-artifact@v2
218204
continue-on-error: true
205+
if: (inputs.triggered_by_callable==false) && (steps.decide_input.outputs.use_new_build=='0')
219206
with:
220-
workflow: ${{ steps.set-fetch-workflow.outputs.linux_yml }}
207+
workflow: sdk_build.yml
221208
run_id: ${{ steps.decide_input.outputs.download_linux_run }}
222209
name: linux_unity
223-
path: built_artifect
210+
path: built_artifact
224211

225-
- name: Fetch MacOS Artifacts
212+
- name: Fetch MacOS Artifacts (OLD)
226213
uses: dawidd6/action-download-artifact@v2
227214
continue-on-error: true
215+
if: (inputs.triggered_by_callable==false) && (steps.decide_input.outputs.use_new_build=='0')
228216
with:
229-
workflow: ${{ steps.set-fetch-workflow.outputs.macos_yml }}
217+
workflow: sdk_build.yml
230218
run_id: ${{ steps.decide_input.outputs.download_macos_run }}
231219
name: macos_unity
232-
path: built_artifect
220+
path: built_artifact
233221

234-
- name: Fetch Windows Artifacts
222+
- name: Fetch Windows Artifacts (OLD)
235223
uses: dawidd6/action-download-artifact@v2
236224
continue-on-error: true
225+
if: (inputs.triggered_by_callable==false) && (steps.decide_input.outputs.use_new_build=='0')
237226
with:
238-
workflow: ${{ steps.set-fetch-workflow.outputs.windows_yml }}
227+
workflow: sdk_build.yml
239228
run_id: ${{ steps.decide_input.outputs.download_windows_run }}
240229
name: windows_unity
241-
path: built_artifect
230+
path: built_artifact
231+
232+
- name: Fetch Android Artifacts (NEW)
233+
uses: dawidd6/action-download-artifact@v2
234+
continue-on-error: true
235+
if: (inputs.triggered_by_callable==false) && (steps.decide_input.outputs.use_new_build=='1')
236+
with:
237+
workflow: build_starter.yml
238+
run_id: ${{ steps.decide_input.outputs.download_android_run }}
239+
name: android_unity
240+
path: built_artifact
241+
242+
- name: Fetch iOS Artifacts (NEW)
243+
uses: dawidd6/action-download-artifact@v2
244+
continue-on-error: true
245+
if: (inputs.triggered_by_callable==false) && (steps.decide_input.outputs.use_new_build=='1')
246+
with:
247+
workflow: build_starter.yml
248+
run_id: ${{ steps.decide_input.outputs.download_ios_run }}
249+
name: ios_unity
250+
path: built_artifact
251+
252+
- name: Fetch Linux Artifacts (NEW)
253+
uses: dawidd6/action-download-artifact@v2
254+
continue-on-error: true
255+
if: (inputs.triggered_by_callable==false) && (steps.decide_input.outputs.use_new_build=='1')
256+
with:
257+
workflow: build_starter.yml
258+
run_id: ${{ steps.decide_input.outputs.download_linux_run }}
259+
name: linux_unity
260+
path: built_artifact
261+
262+
- name: Fetch MacOS Artifacts (NEW)
263+
uses: dawidd6/action-download-artifact@v2
264+
continue-on-error: true
265+
if: (inputs.triggered_by_callable==false) && (steps.decide_input.outputs.use_new_build=='1')
266+
with:
267+
workflow: build_starter.yml
268+
run_id: ${{ steps.decide_input.outputs.download_macos_run }}
269+
name: macos_unity
270+
path: built_artifact
271+
272+
- name: Fetch Windows Artifacts (NEW)
273+
uses: dawidd6/action-download-artifact@v2
274+
continue-on-error: true
275+
if: (inputs.triggered_by_callable==false) && (steps.decide_input.outputs.use_new_build=='1')
276+
with:
277+
workflow: build_starter.yml
278+
run_id: ${{ steps.decide_input.outputs.download_windows_run }}
279+
name: windows_unity
280+
path: built_artifact
281+
282+
# If called by build_start.xml, ignore name search, just grab all artifact exists
283+
- name: Fetch All in build_starter
284+
uses: actions/download-artifact@v3
285+
if: inputs.triggered_by_callable==true
286+
with:
287+
path: built_artifact
242288

243289
- name: move zip files
244290
run: |
245-
cd built_artifect
291+
cd built_artifact
246292
find . -type f -name "*.zip" -exec mv {} . \;
247293
find . -empty -type d -delete
248294
ls -lR
@@ -255,7 +301,7 @@ jobs:
255301
256302
- name: Package unitypackage
257303
run: |
258-
python build_package.py --zip_dir=built_artifect
304+
python build_package.py --zip_dir=built_artifact
259305
260306
- name: Commit Changes if there is any
261307
run: |
@@ -330,7 +376,7 @@ jobs:
330376

331377
- name: Package tgz
332378
run: |
333-
python build_package.py --zip_dir=built_artifect --output_upm=True --output=output_tgz
379+
python build_package.py --zip_dir=built_artifact --output_upm=True --output=output_tgz
334380
335381
- name: Listing output tgz
336382
run: |

0 commit comments

Comments
 (0)