ci: use user-space bootstrap for age and node checks
This commit is contained in:
parent
4eba92e8a2
commit
562073294d
1 changed files with 27 additions and 15 deletions
|
|
@ -24,21 +24,33 @@ jobs:
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
as_root() {
|
install -d -m 755 "$HOME/.local/bin"
|
||||||
if [[ "$(id -u)" = "0" ]]; then
|
echo "PATH=$HOME/.local/bin:$PATH" >> "$GITHUB_ENV"
|
||||||
"$@"
|
export PATH="$HOME/.local/bin:$PATH"
|
||||||
elif command -v sudo >/dev/null 2>&1; then
|
|
||||||
sudo "$@"
|
if ! command -v curl >/dev/null 2>&1; then
|
||||||
else
|
echo "error: curl is required"
|
||||||
echo "error: need root or sudo to install runner dependencies"
|
exit 2
|
||||||
exit 2
|
fi
|
||||||
fi
|
|
||||||
}
|
if ! command -v age >/dev/null 2>&1; then
|
||||||
if command -v apt-get >/dev/null 2>&1; then
|
age_version="1.2.1"
|
||||||
as_root apt-get update
|
arch="$(uname -m)"
|
||||||
as_root apt-get install -y curl ca-certificates nodejs npm age
|
case "${arch}" in
|
||||||
elif command -v apk >/dev/null 2>&1; then
|
x86_64|amd64) age_arch="amd64" ;;
|
||||||
as_root apk add --no-cache curl ca-certificates nodejs npm age
|
aarch64|arm64) age_arch="arm64" ;;
|
||||||
|
*)
|
||||||
|
echo "error: unsupported runner arch for age prebuilt binary: ${arch}"
|
||||||
|
exit 2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
curl -fsSL "https://github.com/FiloSottile/age/releases/download/v${age_version}/age-v${age_version}-linux-${age_arch}.tar.gz" \
|
||||||
|
| tar -xz -C "$HOME/.local/bin" --strip-components=1 age/age age/age-keygen
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then
|
||||||
|
echo "error: node and npm are required on this runner"
|
||||||
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Configure CI Age identity
|
- name: Configure CI Age identity
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue