Skip to content

Commit b7a9426

Browse files
committed
add option to use sudo
Signed-off-by: cpanato <ctadeu@gmail.com>
1 parent d6f2a0b commit b7a9426

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

action.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,22 @@ inputs:
88
description: 'Version of ko to install (tip, latest-release, v0.14.1, etc.)'
99
required: true
1010
default: 'latest-release'
11+
use-sudo:
12+
description: 'set to true if install-dir location requires sudo privs'
13+
required: false
14+
default: 'false'
1115
runs:
1216
using: "composite"
1317
steps:
1418
- shell: bash
1519
run: |
1620
set -ex
1721
22+
SUDO=
23+
if [[ "${{ inputs.use-sudo }}" == "true" ]] && command -v sudo >/dev/null; then
24+
SUDO=sudo
25+
fi
26+
1827
# Install ko:
1928
# - if version is "tip", install from tip of main.
2029
# - if version is "latest-release", look up latest release.
@@ -41,7 +50,7 @@ runs:
4150
fi
4251
if [[ ! -z ${tag} ]]; then
4352
echo "Installing ko @ ${tag} for ${os} ${arch}"
44-
curl -fsL https://github.com/ko-build/ko/releases/download/${tag}/ko_${tag:1}_${os}_${arch}.tar.gz | tar xzf - -C /usr/local/bin ko
53+
curl -fsL https://github.com/ko-build/ko/releases/download/${tag}/ko_${tag:1}_${os}_${arch}.tar.gz | $SUDO tar xzf - -C /usr/local/bin ko
4554
fi
4655
4756
if [[ ! -z ${KO_DOCKER_REPO} ]]; then

0 commit comments

Comments
 (0)