Files
BYW-VoiceHub/patches/0011-fix-ci-Preflight-docker-node-22-bookworm-slim-setup-.patch
T

140 lines
5.2 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
From 7b3294a3804a73d7048afe91a516ebdc55fedbd4 Mon Sep 17 00:00:00 2001
From: HenryDu8133 <813367384@qq.com>
Date: Sun, 6 Sep 2026 10:30:51 +0800
Subject: [PATCH 11/58] =?UTF-8?q?fix(ci):=20Preflight=20=E7=9B=B4=E6=8E=A5?=
=?UTF-8?q?=E8=B7=91=20docker://node:22-bookworm-slim=20=E8=B7=B3=E8=BF=87?=
=?UTF-8?q?=20setup-node=20=E4=B8=8B=E8=BD=BD=EF=BC=88=E5=9B=BD=E5=86=85?=
=?UTF-8?q?=20GitHub=20release=20=E8=B6=85=E6=97=B6=EF=BC=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.gitea/workflows/deploy.yml | 42 +++++++++++++++++++++----------------
1 file changed, 24 insertions(+), 18 deletions(-)
diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml
index 21a8f14..8f44e10 100644
--- a/.gitea/workflows/deploy.yml
+++ b/.gitea/workflows/deploy.yml
@@ -39,7 +39,9 @@ jobs:
# ============================================================
preflight:
name: Preflight 语法 & 构建检查
- runs-on: ubuntu-latest
+ # 国内访问 GitHub actions/node-versions release 经常超时(443 ETIMEDOUT)
+ # 所以直接用官方 node:22 镜像跑这个 Job,绕过 setup-node 下载 step
+ runs-on: [ubuntu-latest:docker://node:22-bookworm-slim]
timeout-minutes: 15
steps:
- name: 📥 Checkout 代码
@@ -47,11 +49,15 @@ jobs:
with:
fetch-depth: 1
- - name: 🔧 安装 Node.js 22
- uses: actions/setup-node@v4
- with:
- node-version: "22"
- cache: "npm"
+ # ── 我们已经用 runs-on: docker://node:22 了,所以这里不需要 actions/setup-node ──
+ # 避免国内 Runner 从 github.com 下载 Node tar.gz 出现 ETIMEDOUT
+ - name: 🔎 环境自检(node/npm 版本)
+ shell: bash
+ run: |
+ set -euxo pipefail
+ node -v
+ npm -v
+ which node npm
- name: 🧪 安装依赖(npm ci,严格按锁文件)
run: |
@@ -92,12 +98,12 @@ jobs:
image_full: ${{ steps.meta.outputs.full }}
image_latest: ${{ steps.meta.outputs.latest }}
steps:
- - name: 📥 Checkout 代码
+ - name: Checkout 代码
uses: actions/checkout@v4
with:
fetch-depth: 1
- - name: 🏷️ 计算镜像 tag(日期 + 短 SHA)
+ - name: 计算镜像 tag(日期 + 短 SHA)
id: meta
shell: bash
run: |
@@ -116,17 +122,17 @@ jobs:
echo "🪪 镜像 latest : ${IMG_LATEST}"
echo "======================================"
- - name: 🔧 启用 QEMU(跨架构小概率用得到,保险)
+ - name: 启用 QEMU(跨架构小概率用得到,保险)
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64
- - name: 🔧 启用 Docker Buildx
+ - name: 启用 Docker Buildx
uses: docker/setup-buildx-action@v3
with:
install: true
- - name: 🔐 登录 Gitea 容器仓库(Packages)
+ - name: 登录 Gitea 容器仓库(Packages)
uses: docker/login-action@v3
with:
registry: ${{ env.GITEA_HOST }}
@@ -135,7 +141,7 @@ jobs:
# Secrets 里 REGISTRY_TOKEN 优先,没填就用 Gitea Actions 自动注入的仓库级 token
password: ${{ secrets.REGISTRY_TOKEN || github.token }}
- - name: 🐳 构建 & 推送(BuildKit 分层缓存,skip_build_cache=true 时禁用)
+ - name: 构建 & 推送(BuildKit 分层缓存,skip_build_cache=true 时禁用)
id: build_push
uses: docker/build-push-action@v6
env:
@@ -159,7 +165,7 @@ jobs:
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.created=${{ github.event.head_commit.timestamp }}
- - name: 🧮 镜像体积 & 层信息(日志里看一下,避免镜像越来越大)
+ - name: 镜像体积 & 层信息(日志里看一下,避免镜像越来越大)
run: |
set -euxo pipefail
docker pull "${{ steps.meta.outputs.full }}" || true
@@ -181,7 +187,7 @@ jobs:
name: production
url: ${{ secrets.NUXT_PUBLIC_SITE_URL }}
steps:
- - name: ⚠️ 检查部署所需 Secrets 是否都配置了
+ - name: 检查部署所需 Secrets 是否都配置了
shell: bash
run: |
set -euo pipefail
@@ -196,7 +202,7 @@ jobs:
fi
echo "✅ 部署 Secrets 配置完整"
- - name: 🚀 一键滚动部署(SSH)
+ - name: 一键滚动部署(SSH)
uses: appleboy/ssh-action@v1.2.0
with:
host: ${{ secrets.DEPLOY_HOST }}
@@ -217,9 +223,9 @@ jobs:
COMPOSE="docker compose"
echo "=============================================="
- echo "🚢 本次部署镜像: ${IMAGE_NEW}"
- echo "🗂️ 部署目录 : ${DEPLOY_DIR}"
- echo "👤 执行用户 : $(whoami)"
+ echo "本次部署镜像: ${IMAGE_NEW}"
+ echo "部署目录 : ${DEPLOY_DIR}"
+ echo "执行用户 : $(whoami)"
echo "=============================================="
# ---------- 1. 确保部署目录存在 ----------
--
2.45.1.windows.1