-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdetermine_build_configuration.yml
More file actions
62 lines (58 loc) · 1.94 KB
/
determine_build_configuration.yml
File metadata and controls
62 lines (58 loc) · 1.94 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
name: Determine Build Configuration
on:
workflow_call:
inputs:
trigger: # 'release' or 'workflow_dispatch'
type: string
required: true
target_branch: # branch name (from release.target_commitish or ref_name)
type: string
required: true
override_build_configuration: # '', 'Release', or 'Debug' when manual
type: string
required: false
default: ''
prerelease: # only meaningful when trigger == 'release'
type: boolean
required: false
default: false
outputs:
build_configuration:
description: "Resolved configuration (Release|Debug)"
value: ${{ jobs.compute.outputs.build_configuration }}
jobs:
compute:
runs-on: ubuntu-latest
outputs:
build_configuration: ${{ steps.out.outputs.build_configuration }}
steps:
- id: out
name: Decide build configuration
run: |
set -euo pipefail
TRIGGER='${{ inputs.trigger }}'
BRANCH='${{ inputs.target_branch }}'
OVERRIDE='${{ inputs.override_build_configuration }}'
PRERELEASE='${{ inputs.prerelease }}'
if [[ -n "$OVERRIDE" ]]; then
CFG="$OVERRIDE"
echo "Manual override → $CFG"
else
if [[ "$TRIGGER" == "release" ]]; then
if [[ "$PRERELEASE" == "false" ]]; then
CFG="Release"
else
CFG="Debug"
fi
echo "Release event on '$BRANCH' (prerelease=$PRERELEASE) → $CFG"
else
# workflow_dispatch default: main => Release, else Debug
if [[ "$BRANCH" == "main" ]]; then
CFG="Release"
else
CFG="Debug"
fi
echo "workflow_dispatch on '$BRANCH' → default $CFG"
fi
fi
echo "build_configuration=$CFG" >> "$GITHUB_OUTPUT"