mirror of
https://github.com/marcel-dempers/docker-development-youtube-series.git
synced 2025-06-04 16:56:56 +00:00
26 lines
726 B
Bash
26 lines
726 B
Bash
#!/bin/sh
|
|
registration_url="https://api.github.com/repos/${GITHUB_OWNER}/${GITHUB_REPOSITORY}/actions/runners/registration-token"
|
|
echo "Requesting registration URL at '${registration_url}'"
|
|
|
|
payload=$(curl -sX POST -H "Authorization: token ${GITHUB_PERSONAL_TOKEN}" ${registration_url})
|
|
export RUNNER_TOKEN=$(echo $payload | jq .token --raw-output)
|
|
|
|
./config.sh \
|
|
--name $(hostname) \
|
|
--token ${RUNNER_TOKEN} \
|
|
-- labels my-runner \
|
|
--url https://github.com/${GITHUB_OWNER}/${GITHUB_REPOSITORY} \
|
|
--work "/work" \
|
|
--unattended \
|
|
--replace
|
|
|
|
remove() {
|
|
./config.sh remove --unattended --token "${RUNNER_TOKEN}"
|
|
}
|
|
|
|
trap 'remove; exit 130' INT
|
|
trap 'remove; exit 143' TERM
|
|
|
|
./run.sh "$*" &
|
|
|
|
wait $! |