-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
action.yaml
88 lines (79 loc) · 2.89 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Install aqua
description: Install aqua https://aquaproj.github.io/ and install tools with aqua
inputs:
aqua_version:
description: Installed aqua's version (e.g. v0.8.7)
required: true
enable_aqua_install:
required: false
default: "true"
description: Whether "aqua i" command is run.
aqua_opts:
required: false
default: "-l"
description: Command line options for "aqua i"
policy_allow:
required: false
description: |
aqua >= v2.3.0
If this isn't empty, "aqua policy allow" is run.
If this is "true", "aqua policy allow" is run without argument.
If this isn't empty and isn't "true", "aqua policy allow <inputs.policy_allow>" is run.
skip_install_aqua:
required: false
default: "false"
description: If this true and aqua is already installed, installing aqua is skipped.
working_directory:
required: false
default: ""
description: The working directory to run aqua commands
runs:
using: composite
steps:
- run: |
echo "::error ::aqua_version is required. https://github.com/aquaproj/aqua-installer"
exit 1
shell: bash
if: inputs.aqua_version == ''
- run: echo "${AQUA_ROOT_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/aquaproj-aqua}/bin" >> $GITHUB_PATH
shell: bash
working-directory: ${{ inputs.working_directory }}
if: runner.os != 'Windows'
- run: |
echo "${AQUA_ROOT_DIR:-$HOME/AppData/Local/aquaproj-aqua}/bin" >> $GITHUB_PATH
shell: bash
working-directory: ${{ inputs.working_directory }}
if: runner.os == 'Windows'
- run: |
$(if($env:AQUA_ROOT_DIR) {echo $env:AQUA_ROOT_DIR} else {echo "$HOME/AppData/Local/aquaproj-aqua/bin"}) | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
shell: pwsh
working-directory: ${{ inputs.working_directory }}
if: runner.os == 'Windows'
- run: |
if [ "${SKIP_INSTALL_AQUA:-}" = true ] && command -v aqua >/dev/null; then
echo "[INFO] Installing aqua is skipped" >&2
exit 0
fi
"${GITHUB_ACTION_PATH}/aqua-installer" -v "$AQUA_VERSION"
working-directory: ${{ inputs.working_directory }}
shell: bash
env:
AQUA_VERSION: ${{ inputs.aqua_version }}
SKIP_INSTALL_AQUA: ${{ inputs.skip_install_aqua }}
- run: aqua policy allow
working-directory: ${{ inputs.working_directory }}
if: inputs.policy_allow == 'true'
shell: bash
- run: aqua policy allow "$POLICY_FILE"
working-directory: ${{ inputs.working_directory }}
if: |
inputs.policy_allow != 'true' && inputs.policy_allow != ''
shell: bash
env:
POLICY_FILE: ${{ inputs.policy_allow }}
- run: aqua i $AQUA_OPTS
if: inputs.enable_aqua_install == 'true'
working-directory: ${{ inputs.working_directory }}
shell: bash
env:
AQUA_OPTS: ${{ inputs.aqua_opts }}