Skip to content

Commit dab1bfc

Browse files
committed
add manual knob
1 parent ba482e8 commit dab1bfc

1 file changed

Lines changed: 43 additions & 16 deletions

File tree

.github/workflows/build-unitycloud.yml

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,15 @@ on:
7878
required: false
7979
default: false
8080
type: boolean
81+
platforms:
82+
description: 'Which platforms to build'
83+
required: true
84+
default: 'both'
85+
type: choice
86+
options:
87+
- both
88+
- windows-only
89+
- macos-only
8190
workflow_call:
8291
inputs:
8392
profile:
@@ -423,27 +432,45 @@ jobs:
423432
run: |
424433
set -euo pipefail
425434
426-
labels="${{ join(github.event.pull_request.labels.*.name, ' ') }}"
427-
echo "Labels: '$labels'"
428-
429-
has_windows_only=false
430-
has_macos_only=false
431-
if echo "$labels" | grep -qw 'windows-only'; then has_windows_only=true; fi
432-
if echo "$labels" | grep -qw 'macos-only'; then has_macos_only=true; fi
435+
# platform_build_mode: windows | macos | both
436+
platform_build_mode=both
433437
434-
if [ "$has_windows_only" = "true" ] && [ "$has_macos_only" = "true" ]; then
435-
echo "::error::Both 'windows-only' and 'macos-only' labels are applied. Remove one — they are mutually exclusive."
436-
exit 1
437-
fi
438+
dispatch_platforms="${{ github.event.inputs.platforms }}"
439+
echo "Dispatch platforms: '$dispatch_platforms'"
438440
439-
if [ "$has_windows_only" = "true" ]; then
440-
targets='["windows64"]'
441-
elif [ "$has_macos_only" = "true" ]; then
442-
targets='["macos"]'
441+
if [ "$dispatch_platforms" = "windows-only" ]; then
442+
platform_build_mode=windows
443+
elif [ "$dispatch_platforms" = "macos-only" ]; then
444+
platform_build_mode=macos
443445
else
444-
targets='["windows64","macos"]'
446+
labels="${{ join(github.event.pull_request.labels.*.name, ' ') }}"
447+
echo "Labels: '$labels'"
448+
449+
label_match_count=0
450+
if echo "$labels" | grep -qw 'windows-only'; then
451+
platform_build_mode=windows
452+
label_match_count=$((label_match_count + 1))
453+
fi
454+
if echo "$labels" | grep -qw 'macos-only'; then
455+
platform_build_mode=macos
456+
label_match_count=$((label_match_count + 1))
457+
fi
458+
459+
if [ "$label_match_count" -gt 1 ]; then
460+
echo "::error::Both 'windows-only' and 'macos-only' labels are applied. Remove one — they are mutually exclusive."
461+
exit 1
462+
fi
445463
fi
446464
465+
echo "Platform build mode: $platform_build_mode"
466+
467+
case "$platform_build_mode" in
468+
windows) targets='["windows64"]' ;;
469+
macos) targets='["macos"]' ;;
470+
both) targets='["windows64","macos"]' ;;
471+
*) echo "::error::Unknown platform_build_mode '$platform_build_mode'"; exit 1 ;;
472+
esac
473+
447474
echo "Targets: $targets"
448475
echo "targets=$targets" >> "$GITHUB_OUTPUT"
449476

0 commit comments

Comments
 (0)