ci deploy (src 8055276)
This commit is contained in:
44
ci-runner-entry.sh
Normal file
44
ci-runner-entry.sh
Normal file
@ -0,0 +1,44 @@
|
||||
#!/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
|
||||
|
||||
# runner v1.x 要求 go>=1.26;1.26 向下兼容编译 go.mod 1.25 的项目
|
||||
GO_VERSION=1.26.4
|
||||
# v1.x 起模块改名 gitea.com/gitea/runner(旧名 act_runner 装不上),二进制名也是 runner
|
||||
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/runner" ]; then
|
||||
echo "[ci-runner] installing gitea runner $RUNNER_VERSION ..."
|
||||
go install "gitea.com/gitea/runner@${RUNNER_VERSION}"
|
||||
fi
|
||||
|
||||
mkdir -p /data/runner
|
||||
cd /data/runner
|
||||
if [ ! -f .runner ]; then
|
||||
echo "[ci-runner] registering ..."
|
||||
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 runner daemon
|
||||
Reference in New Issue
Block a user