x
Some checks failed
Build docker and publish / build (20.15.1) (push) Failing after 1m1s

This commit is contained in:
shanshanzhong 2025-09-26 19:00:51 -07:00
parent b9b0dc3bda
commit 6a146f0898

View File

@ -41,7 +41,42 @@ jobs:
- name: 📥 下载代码
uses: actions/checkout@v4
# 步骤2: 打包编译 (直接使用Go构建)
# 步骤2: 安装系统工具 (Docker, curl, jq)
- name: 🔧 安装系统工具 (Docker, curl, jq)
run: |
set -e
export DEBIAN_FRONTEND=noninteractive
echo "等待 apt/dpkg 锁释放 (unattended-upgrades)..."
# 等待最多 300 秒让 unattended-upgrades/apt/dpkg 锁释放
end=$((SECONDS+300))
while true; do
LOCKS_BUSY=0
# 如果 unattended-upgrades 正在运行,标记为忙碌
if pgrep -x unattended-upgrades >/dev/null 2>&1; then LOCKS_BUSY=1; fi
# 如果 fuser 存在,检查常见的锁文件
if command -v fuser >/dev/null 2>&1; then
if fuser /var/lib/dpkg/lock >/dev/null 2>&1 \
|| fuser /var/lib/dpkg/lock-frontend >/dev/null 2>&1 \
|| fuser /var/lib/apt/lists/lock >/dev/null 2>&1; then
LOCKS_BUSY=1
fi
fi
# 如果不忙碌则跳出循环
if [ "$LOCKS_BUSY" -eq 0 ]; then break; fi
# 超时后约 5 分钟
if [ $SECONDS -ge $end ]; then
echo "等待 apt/dpkg 锁超时,使用 Dpkg::Lock::Timeout 继续..."
break
fi
echo "仍在等待锁释放..."; sleep 5
done
apt-get update -y -o Dpkg::Lock::Timeout=600
apt-get install -y -o Dpkg::Lock::Timeout=600 jq curl ca-certificates docker.io
docker --version
jq --version
curl --version
# 步骤3: 打包编译 (直接使用Go构建)
- name: 🔨 打包编译
run: |
echo "开始Go编译..."
@ -55,7 +90,7 @@ jobs:
echo "Docker镜像构建完成"
# 步骤3: 发布到镜像仓库
# 步骤4: 发布到镜像仓库
- name: 📤 发布到镜像仓库
run: |
echo "开始推送镜像到仓库..."
@ -66,7 +101,7 @@ jobs:
echo "镜像推送完成"
# 步骤4: 连接服务器拉镜像启动
# 步骤5: 连接服务器拉镜像启动
- name: 🚀 连接服务器拉镜像启动
uses: appleboy/ssh-action@v1.0.3
with: