deploy: M6a 看板瘦身 + CI runner 入口脚本 (src 136386a)
This commit is contained in:
42
ci-runner-entry.sh
Normal file
42
ci-runner-entry.sh
Normal file
@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
# Gitea Actions runner 容器入口(在 node:20-bookworm 镜像内执行)。
|
||||
# NAS compose 的 ci-runner 服务启动时从公开产物仓 curl 本脚本执行——
|
||||
# 改本文件 + 发版 + 重启 ci-runner 容器即可更新 runner 逻辑。
|
||||
# /data 是持久卷:Go 工具链、模块/构建缓存、act_runner 注册状态都在里面,
|
||||
# 容器重建不丢。需要环境变量 RUNNER_REG_TOKEN(仅首次注册时使用)。
|
||||
set -e
|
||||
|
||||
GO_VERSION=1.25.3
|
||||
ACT_RUNNER_VERSION=v1.0.8
|
||||
|
||||
export GOPATH=/data/gopath
|
||||
export GOMODCACHE=/data/gomod
|
||||
export GOCACHE=/data/gocache
|
||||
export GOPROXY=https://goproxy.cn,direct
|
||||
export PATH=/data/go/bin:$GOPATH/bin:$PATH
|
||||
|
||||
if [ ! -x /data/go/bin/go ]; then
|
||||
echo "[ci-runner] downloading go $GO_VERSION ..."
|
||||
curl -fsSL -o /tmp/go.tgz "https://mirrors.aliyun.com/golang/go${GO_VERSION}.linux-amd64.tar.gz"
|
||||
tar -C /data -xzf /tmp/go.tgz
|
||||
rm /tmp/go.tgz
|
||||
fi
|
||||
|
||||
if [ ! -x "$GOPATH/bin/act_runner" ]; then
|
||||
echo "[ci-runner] installing act_runner $ACT_RUNNER_VERSION ..."
|
||||
go install "gitea.com/gitea/act_runner@${ACT_RUNNER_VERSION}"
|
||||
fi
|
||||
|
||||
mkdir -p /data/runner
|
||||
cd /data/runner
|
||||
if [ ! -f .runner ]; then
|
||||
echo "[ci-runner] registering ..."
|
||||
act_runner register --no-interactive \
|
||||
--instance https://git.xindiegaming.top \
|
||||
--token "$RUNNER_REG_TOKEN" \
|
||||
--name nas-runner \
|
||||
--labels nas:host
|
||||
fi
|
||||
|
||||
echo "[ci-runner] daemon up"
|
||||
exec act_runner daemon
|
||||
Reference in New Issue
Block a user