Skip to content

Commit e482b89

Browse files
committed
Made runners dynamic + fixed issue with Linux combined builds
1 parent 65f48b5 commit e482b89

34 files changed

+414
-87
lines changed
Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,26 @@
11
{
22
"Android": {
3-
"os": "ubuntu-latest",
43
"minimumBuildType": "preview"
54
},
65
"WebGL": {
7-
"os": "ubuntu-latest",
86
"minimumBuildType": "preview"
97
},
108
"StandaloneLinux64-Client": {
11-
"os": "ubuntu-latest",
129
"minimumBuildType": "preview"
1310
},
1411
"StandaloneLinux64-Server": {
15-
"os": "ubuntu-latest",
1612
"minimumBuildType": "preview"
1713
},
1814
"StandaloneWindows": {
19-
"os": "ubuntu-latest",
2015
"minimumBuildType": "preview"
2116
},
2217
"StandaloneWindows64": {
23-
"os": "ubuntu-latest",
2418
"minimumBuildType": "preview"
2519
},
2620
"StandaloneOSX": {
27-
"os": "macos-latest",
2821
"minimumBuildType": "preview"
2922
},
3023
"iOS": {
31-
"os": "macos-latest",
3224
"minimumBuildType": "preview"
3325
}
3426
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: 'Resolve Runners'
2+
description: 'Resolve MAIN and MACOS runner labels with validation and fallback logic'
3+
4+
inputs:
5+
main:
6+
description: 'Custom label for main runner'
7+
required: false
8+
default: 'ubuntu-latest'
9+
macos:
10+
description: 'Custom label for macOS runner'
11+
required: false
12+
default: 'macos-latest'
13+
14+
outputs:
15+
main:
16+
description: 'Resolved main runner label'
17+
value: ${{ steps.resolve_runners.outputs.main }}
18+
macos:
19+
description: 'Resolved macOS runner label'
20+
value: ${{ steps.resolve_runners.outputs.macos }}
21+
22+
runs:
23+
using: 'composite'
24+
steps:
25+
- name: Make script executable
26+
shell: bash
27+
run: chmod +x "${{ github.action_path }}/resolve-runners.sh"
28+
29+
- id: resolve_runners
30+
name: Run runner resolver
31+
shell: bash
32+
env:
33+
GH_TOKEN: ${{ env.GH_TOKEN }}
34+
MAIN_INPUT: ${{ inputs.main }}
35+
MACOS_INPUT: ${{ inputs.macos }}
36+
REPO: ${{ github.repository }}
37+
run: |
38+
bash "${{ github.action_path }}/resolve-runners.sh"
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/bin/bash
2+
set -e
3+
4+
echo "🔧 Resolving runners..."
5+
6+
# Load runner list from JSON
7+
RUNNER_JSON="${GITHUB_ACTION_PATH}/runners.json"
8+
9+
if [[ ! -f "$RUNNER_JSON" ]]; then
10+
echo "❌ runners.json not found at $RUNNER_JSON"
11+
exit 1
12+
fi
13+
14+
mapfile -t GITHUB_RUNNERS < <(jq -r '.githubHostedRunners[]' "$RUNNER_JSON")
15+
16+
is_github_hosted() {
17+
local label="$1"
18+
for runner in "${GITHUB_RUNNERS[@]}"; do
19+
if [[ "$runner" == "$label" ]]; then
20+
return 0
21+
fi
22+
done
23+
return 1
24+
}
25+
26+
validate_runner() {
27+
local label="$1"
28+
echo "🔍 Checking if self-hosted runner label '$label' exists..."
29+
MATCH=$(gh api repos/"$REPO"/actions/runners \
30+
--paginate --jq '.runners[].labels[].name' | grep -x "$label" || true)
31+
if [[ -z "$MATCH" ]]; then
32+
echo "❌ No self-hosted runners found with label '$label'"
33+
exit 1
34+
else
35+
echo "✅ Valid self-hosted runner label: '$label'"
36+
fi
37+
}
38+
39+
# ───── Resolve MAIN ─────
40+
MAIN="${MAIN_INPUT:-ubuntu-latest}"
41+
echo "🎯 Resolved MAIN: '$MAIN'"
42+
43+
if is_github_hosted "$MAIN"; then
44+
echo "✅ '$MAIN' is GitHub-hosted. Skipping validation."
45+
else
46+
validate_runner "$MAIN"
47+
fi
48+
49+
# ───── Resolve MACOS ─────
50+
MACOS="${MACOS_INPUT:-macos-latest}"
51+
echo "🎯 Resolved MACOS: '$MACOS'"
52+
53+
if is_github_hosted "$MACOS"; then
54+
echo "✅ '$MACOS' is GitHub-hosted. Skipping validation."
55+
else
56+
validate_runner "$MACOS"
57+
fi
58+
59+
# Output
60+
echo "main=$MAIN" >> "$GITHUB_OUTPUT"
61+
echo "macos=$MACOS" >> "$GITHUB_OUTPUT"
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"githubHostedRunners": [
3+
"ubuntu-latest",
4+
"ubuntu-24.04",
5+
"ubuntu-22.04",
6+
"ubuntu-20.04",
7+
"windows-latest",
8+
"windows-2025",
9+
"windows-2022",
10+
"windows-2019",
11+
"macos-latest",
12+
"macos-15",
13+
"macos-15-large",
14+
"macos-14",
15+
"macos-14-large",
16+
"macos-13",
17+
"macos-13-large",
18+
"macos-12",
19+
"macos-15-arm64",
20+
"macos-15-xlarge",
21+
"macos-14-arm64",
22+
"macos-14-xlarge",
23+
"macos-13-arm64",
24+
"macos-13-xlarge",
25+
"macos-latest-large",
26+
"macos-latest-xlarge"
27+
]
28+
}

.github/actions/validate-deploy-targets/deploy-targets.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,40 @@
11
{
22
"gh-pages": {
3-
"os": "ubuntu-latest",
43
"requiresCombinedArtifact": false,
54
"minimumBuildType": "release",
65
"compatibleBuildTargets": ["WebGL"]
76
},
87
"itch.io": {
9-
"os": "ubuntu-latest",
108
"requiresCombinedArtifact": false,
119
"minimumBuildType": "release",
1210
"compatibleBuildTargets": ["WebGL", "StandaloneWindows", "StandaloneWindows64", "StandaloneLinux64-Client", "StandaloneOSX"]
1311
},
1412
"s3": {
15-
"os": "ubuntu-latest",
1613
"requiresCombinedArtifact": true,
1714
"minimumBuildType": "preview",
1815
"compatibleBuildTargets": ["Android", "iOS", "WebGL", "StandaloneWindows", "StandaloneWindows64", "StandaloneLinux64-Server", "StandaloneOSX"]
1916
},
2017
"custom-server": {
21-
"os": "ubuntu-latest",
2218
"requiresCombinedArtifact": true,
2319
"minimumBuildType": "preview",
2420
"compatibleBuildTargets": ["Android", "iOS", "WebGL", "StandaloneWindows", "StandaloneWindows64", "StandaloneLinux64-Server", "StandaloneOSX"]
2521
},
2622
"steam": {
27-
"os": "ubuntu-latest",
2823
"requiresCombinedArtifact": true,
2924
"minimumBuildType": "release",
3025
"compatibleBuildTargets": ["StandaloneWindows", "StandaloneWindows64", "StandaloneLinux64-Client", "StandaloneOSX"]
3126
},
3227
"testflight": {
33-
"os": "macos-latest",
3428
"requiresCombinedArtifact": false,
3529
"minimumBuildType": "release_candidate",
3630
"compatibleBuildTargets": ["iOS"]
3731
},
3832
"appcenter": {
39-
"os": "ubuntu-latest",
4033
"requiresCombinedArtifact": true,
4134
"minimumBuildType": "preview",
4235
"compatibleBuildTargets": ["Android", "iOS"]
4336
},
4437
"firebase": {
45-
"os": "ubuntu-latest",
4638
"requiresCombinedArtifact": true,
4739
"minimumBuildType": "release",
4840
"compatibleBuildTargets": ["WebGL"]

.github/config/build-targets.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,26 @@
11
{
22
"Android": {
3-
"os": "ubuntu-latest",
43
"minimumBuildType": "preview"
54
},
65
"WebGL": {
7-
"os": "ubuntu-latest",
86
"minimumBuildType": "preview"
97
},
108
"StandaloneLinux64-Client": {
11-
"os": "ubuntu-latest",
129
"minimumBuildType": "preview"
1310
},
1411
"StandaloneLinux64-Server": {
15-
"os": "ubuntu-latest",
1612
"minimumBuildType": "preview"
1713
},
1814
"StandaloneWindows": {
19-
"os": "ubuntu-latest",
2015
"minimumBuildType": "preview"
2116
},
2217
"StandaloneWindows64": {
23-
"os": "ubuntu-latest",
2418
"minimumBuildType": "preview"
2519
},
2620
"StandaloneOSX": {
27-
"os": "macos-latest",
2821
"minimumBuildType": "preview"
2922
},
3023
"iOS": {
31-
"os": "macos-latest",
3224
"minimumBuildType": "preview"
3325
}
3426
}

.github/config/deploy-targets.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,40 @@
11
{
22
"gh-pages": {
3-
"os": "ubuntu-latest",
43
"requiresCombinedArtifact": false,
54
"minimumBuildType": "release",
65
"compatibleBuildTargets": ["WebGL"]
76
},
87
"itch.io": {
9-
"os": "ubuntu-latest",
108
"requiresCombinedArtifact": false,
119
"minimumBuildType": "release",
1210
"compatibleBuildTargets": ["WebGL", "StandaloneWindows", "StandaloneWindows64", "StandaloneLinux64-Client", "StandaloneOSX"]
1311
},
1412
"s3": {
15-
"os": "ubuntu-latest",
1613
"requiresCombinedArtifact": true,
1714
"minimumBuildType": "preview",
1815
"compatibleBuildTargets": ["Android", "iOS", "WebGL", "StandaloneWindows", "StandaloneWindows64", "StandaloneLinux64-Server", "StandaloneOSX"]
1916
},
2017
"custom-server": {
21-
"os": "ubuntu-latest",
2218
"requiresCombinedArtifact": true,
2319
"minimumBuildType": "preview",
2420
"compatibleBuildTargets": ["Android", "iOS", "WebGL", "StandaloneWindows", "StandaloneWindows64", "StandaloneLinux64-Server", "StandaloneOSX"]
2521
},
2622
"steam": {
27-
"os": "ubuntu-latest",
2823
"requiresCombinedArtifact": true,
2924
"minimumBuildType": "release",
3025
"compatibleBuildTargets": ["StandaloneWindows", "StandaloneWindows64", "StandaloneLinux64-Client", "StandaloneOSX"]
3126
},
3227
"testflight": {
33-
"os": "macos-latest",
3428
"requiresCombinedArtifact": false,
3529
"minimumBuildType": "release_candidate",
3630
"compatibleBuildTargets": ["iOS"]
3731
},
3832
"appcenter": {
39-
"os": "ubuntu-latest",
4033
"requiresCombinedArtifact": true,
4134
"minimumBuildType": "preview",
4235
"compatibleBuildTargets": ["Android", "iOS"]
4336
},
4437
"firebase": {
45-
"os": "ubuntu-latest",
4638
"requiresCombinedArtifact": true,
4739
"minimumBuildType": "release",
4840
"compatibleBuildTargets": ["WebGL"]

.github/workflows/build-version-resolver.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: 🔖 Version Resolver
33
on:
44
workflow_call:
55
inputs:
6+
runnerMain:
7+
type: string
8+
required: true
69
buildType:
710
description: "Build type: preview | release_candidate | release"
811
required: true
@@ -19,7 +22,7 @@ on:
1922
jobs:
2023
version_resolver:
2124
name: Generate Build Version
22-
runs-on: ubuntu-latest
25+
runs-on: ${{ inputs.runnerMain }}
2326
outputs:
2427
buildVersion: ${{ steps.get_version.outputs.version }}
2528

.github/workflows/build-version-tagger.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ name: 🏷️ Version Tagger
33
on:
44
workflow_dispatch:
55
inputs:
6+
runnerMain:
7+
type: string
8+
required: true
9+
default: 'ubuntu-latest'
610
buildType:
711
description: "Build type: preview | release_candidate | release"
812
type: string
@@ -13,6 +17,9 @@ on:
1317
required: true
1418
workflow_call:
1519
inputs:
20+
runnerMain:
21+
type: string
22+
required: true
1623
buildVersion:
1724
type: string
1825
required: true
@@ -24,7 +31,7 @@ jobs:
2431
tag_resolver:
2532
name: 🏷️ Resolve & Create Tag
2633
if: ${{ inputs.buildType != 'preview' }}
27-
runs-on: ubuntu-latest
34+
runs-on: ${{ inputs.runnerMain }}
2835
outputs:
2936
buildVersion: ${{ steps.set_version.outputs.version }}
3037
tag_existed: ${{ steps.tag_exists.outputs.exists }}
@@ -54,7 +61,7 @@ jobs:
5461
5562
summarize_tagging:
5663
name: 📄 Summarize Tagging Info
57-
runs-on: ubuntu-latest
64+
runs-on: ${{ inputs.runnerMain }}
5865
needs: tag_resolver
5966
if: always()
6067
steps:

0 commit comments

Comments
 (0)