-
Notifications
You must be signed in to change notification settings - Fork 3
/
action.yaml
74 lines (67 loc) · 2.39 KB
/
action.yaml
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
63
64
65
66
67
68
69
70
71
72
73
74
name: Install YQ
description: |
Installs a version of YQ into the job tool cache using simple shell scripts
branding:
icon: copy
color: orange
inputs:
version:
required: false
description: "Version of YQ to install"
default: "v4.28.1"
download-compressed:
required: false
description: "If 'true', downloads .tar.gz of binary rather than raw binary. Save the tubes."
default: 'true'
force:
required: false
description: "If 'true', does not check for existing yq installation before continuing."
default: 'false'
outputs:
found:
description: "If 'true', yq was already found on this runner"
value: "${{ steps.yq-check-unix.outputs.found == 'true' || steps.yq-check-windows.outputs.found == 'true' }}"
installed:
description: "If 'true', yq was installed by this action"
value: "${{ inputs.force == 'true' || steps.yq-check-unix.outputs.found == 'false' || steps.yq-check-windows.outputs.found == 'false' }}"
runs:
using: composite
steps:
- name: 'Check for yq - Unix-ish'
id: yq-check-unix
if: (runner.os == 'Linux' || runner.os == 'macOS')
shell: bash +e {0}
run: |
_yq_bin="$(which yq)"
if [ -f "${_yq_bin}" ]; then
echo "found=true" >> $GITHUB_OUTPUT
else
echo "found=false" >> $GITHUB_OUTPUT
fi
- name: 'Install yq - Unix-ish'
if: (runner.os == 'Linux' || runner.os == 'macOS') && (steps.yq-check-unix.outputs.found == 'false' || inputs.force == 'true')
shell: bash
env:
DL_COMPRESSED: "${{ inputs.download-compressed == 'true' }}"
YQ_VERSION: '${{ inputs.version }}'
run: $GITHUB_ACTION_PATH/scripts/unixish.sh
- name: 'Check for yq - Windows-ish'
id: yq-check-windows
if: runner.os == 'Windows'
shell: powershell
run: |
if (Get-Command "yq.exe" -ErrorAction SilentlyContinue)
{
Add-Content $Env:GITHUB_OUTPUT "found=true"
}
else
{
Add-Content $Env:GITHUB_OUTPUT "found=false"
}
- name: 'Install yq - Windows-ish'
if: runner.os == 'Windows' && (steps.yq-check-windows.outputs.found == 'false' || inputs.force == 'true')
shell: powershell
env:
DL_COMPRESSED: "${{ inputs.download-compressed == 'true' }}"
YQ_VERSION: '${{ inputs.version }}'
run: '& $Env:GITHUB_ACTION_PATH\scripts\windowsish.ps1'