32 lines
1.2 KiB
Bash
32 lines
1.2 KiB
Bash
#!/usr/bin/env bash
|
|
# Installe et enregistre le runner de recette depuis les fichiers versionnés du dashboard.
|
|
set -Eeuo pipefail
|
|
|
|
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
readonly RUNNER_DIR="/opt/manus-deploy/gitea-runner"
|
|
readonly GITEA_CONTAINER="gitea"
|
|
readonly GITEA_URL="https://git.recette.santinova-soft.org"
|
|
readonly RUNNER_NAME="recette-docker-runner"
|
|
readonly RUNNER_LABELS="ubuntu-latest:docker://node:22-bookworm"
|
|
|
|
install -d -m 0750 "${RUNNER_DIR}"
|
|
install -m 0640 "${SCRIPT_DIR}/gitea-act-runner-config.yaml" "${RUNNER_DIR}/config.yaml"
|
|
install -D -m 0644 "${SCRIPT_DIR}/gitea-act-runner.service" /etc/systemd/system/gitea-act-runner.service
|
|
|
|
if [[ ! -f "${RUNNER_DIR}/.runner" ]]; then
|
|
token="$(docker exec -u git "${GITEA_CONTAINER}" gitea actions generate-runner-token)"
|
|
(
|
|
cd "${RUNNER_DIR}"
|
|
/usr/local/bin/act_runner register --no-interactive \
|
|
--instance "${GITEA_URL}" \
|
|
--token "${token}" \
|
|
--name "${RUNNER_NAME}" \
|
|
--labels "${RUNNER_LABELS}" \
|
|
--config "${RUNNER_DIR}/config.yaml"
|
|
)
|
|
fi
|
|
|
|
systemctl daemon-reload
|
|
systemctl enable --now gitea-act-runner.service
|
|
systemctl is-active gitea-act-runner.service
|