forked from web-infra-dev/rspack
-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (50 loc) · 1.85 KB
/
get-runner-labels.yml
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
name: Get Runner Labels
on:
workflow_call:
inputs:
force-use-github-runner:
type: boolean
description: "Force use github runner"
required: false
default: false
outputs:
LINUX_RUNNER_LABELS:
description: "linux runner labels"
value: ${{ jobs.main.outputs.LINUX_RUNNER_LABELS }}
MACOS_RUNNER_LABELS:
description: "macos runner labels"
value: ${{ jobs.main.outputs.MACOS_RUNNER_LABELS }}
WINDOWS_RUNNER_LABELS:
description: "windows runner labels"
value: ${{ jobs.main.outputs.WINDOWS_RUNNER_LABELS }}
jobs:
main:
name: Get Runner Labels
runs-on: ubuntu-latest
outputs:
LINUX_RUNNER_LABELS: ${{ steps.run.outputs.LINUX_RUNNER_LABELS }}
MACOS_RUNNER_LABELS: ${{ steps.run.outputs.MACOS_RUNNER_LABELS }}
WINDOWS_RUNNER_LABELS: ${{ steps.run.outputs.WINDOWS_RUNNER_LABELS }}
steps:
- id: run
shell: bash
run: |
if ${{ !inputs.force-use-github-runner }}; then
LINUX_RUNNER_LABELS='${{ vars.LINUX_RUNNER_LABELS }}';
MACOS_RUNNER_LABELS='${{ vars.MACOS_RUNNER_LABELS }}';
WINDOWS_RUNNER_LABELS='${{ vars.WINDOWS_RUNNER_LABELS }}';
fi
# set default value
if [[ -z "$LINUX_RUNNER_LABELS" ]]; then
LINUX_RUNNER_LABELS='"ubuntu-latest"';
fi
if [[ -z "$MACOS_RUNNER_LABELS" ]]; then
MACOS_RUNNER_LABELS='"macos-latest"';
fi
if [[ -z "$WINDOWS_RUNNER_LABELS" ]]; then
WINDOWS_RUNNER_LABELS='"windows-latest"';
fi
# set output
echo "LINUX_RUNNER_LABELS=$LINUX_RUNNER_LABELS" >> "$GITHUB_OUTPUT"
echo "MACOS_RUNNER_LABELS=$MACOS_RUNNER_LABELS" >> "$GITHUB_OUTPUT"
echo "WINDOWS_RUNNER_LABELS=$WINDOWS_RUNNER_LABELS" >> "$GITHUB_OUTPUT"