2
0
Fork 0

sh.zio.github-runner-wrapper: add Github Runner Wrapper

main
Ducky 2023-12-03 02:33:53 +00:00
parent c952be0c12
commit 3a3dde0ff6
4 changed files with 56 additions and 0 deletions

9
.gitignore vendored
View File

@ -46,6 +46,7 @@
!/usr/local/bin/
/usr/local/bin/*
!/usr/local/bin/sh.zio.backup
!/usr/local/bin/sh.zio.github-runner-wrapper
!/usr/local/bin/sh.zio.install-package
!/usr/local/bin/sh.zio.pod-exec
!/usr/local/bin/sh.zio.pod-systemd
@ -61,6 +62,14 @@
/usr/local/libexec/*
!/usr/local/libexec/zio-helpers
# /usr/local/libexec/sodalite/
!/usr/local/libexec/sodalite/
/usr/local/libexec/sodalite/*
# /usr/local/libexec/sodalite/invoker
!/usr/local/libexec/sodalite/invoker
/usr/local/libexec/sodalite/invoker/*
# /usr/local/libexec/zio/
!/usr/local/libexec/zio/
/usr/local/libexec/zio/*

3
.gitmodules vendored 100644
View File

@ -0,0 +1,3 @@
[submodule "usr/local/libexec/sodalite/invoker"]
path = usr/local/libexec/sodalite/invoker
url = https://github.com/sodaliterocks/invoker

View File

@ -0,0 +1,43 @@
#!/usr/bin/env bash
_PLUG_TITLE="GitHub Runner Wrapper"
_PLUG_DESCRIPTION=""
_PLUG_ARGS=(
"token;t;;string"
"url;u;;string"
"ex-version;;;string;2.311.0"
"ex-version-arch;;;string;x64"
)
_PLUG_POSITIONAL="url token"
function main() {
identifier="$(echo $_url | sed -e "s|https://github.com/||" -e "s|/|.|g")"
gh_runner_dir="$HOME/.local/bin/gh-runner_$identifier"
download_path="https://github.com/actions/runner/releases/download/v$_ex_version/actions-runner-linux-$_ex_version_arch-$_ex_version.tar.gz"
mkdir -p "$gh_runner_dir"
cd "$gh_runner_dir"
if [ -z "$(ls -A $gh_runner_dir)" ]; then
curl -o "actions-runner-linux-$_ex_version.tar.gz" -L "$download_path"
tar xzf "actions-runner-linux-$_ex_version.tar.gz"
rm "actions-runner-linux-$_ex_version.tar.gz"
fi
if [[ ! -f ".credentials" ]]; then
./config.sh --url "$url" --token "$token" --unattended
fi
./run.sh
}
if [[ $_PLUG_INVOKED != "true" ]]; then
base_dir="$(dirname "$(realpath -s "$0")")"
git_dir="$base_dir/../../.."
if [[ -d "$git_dir/.git" ]]; then
"$git_dir/usr/local/libexec/sodalite/invoker/src/invoke.sh" "$0" $@
else
"/usr/local/libexec/sodalite/invoker/src/invoke.sh" "$0" $@
fi
fi

@ -0,0 +1 @@
Subproject commit eab2016a970f6adbfdb1f8387e983ef54843b664