Skip to content

Instantly share code, notes, and snippets.

@hoegaarden
Last active March 30, 2020 15:59
Show Gist options
  • Save hoegaarden/4c3baea64981eeffc75fa4d466862da5 to your computer and use it in GitHub Desktop.
Save hoegaarden/4c3baea64981eeffc75fa4d466862da5 to your computer and use it in GitHub Desktop.
install github runner
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
readonly RUNNER_URL='https://github.com/actions/runner/releases/download/v2.165.2/actions-runner-linux-x64-2.165.2.tar.gz'
main() {
local org="${1}"
local repo="${2}"
local name="${3}"
local token="${4}"
local dir='/var/lib/github-runner'
export RUNNER_ALLOW_RUNASROOT=1
mkdir -p "${dir}"
cd "${dir}"
curl -L "${RUNNER_URL}" | tar -xzf -
./bin/installdependencies.sh
[ -e ./svc.sh ] || {
./config.sh --unattended --url "https://github.com/${org}/${repo}" --token "${token}" --name "${name}" --replace
}
./svc.sh install
./svc.sh start
}
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment