From 6e7179eb248082cb096e4bf9f73152b54e736864 Mon Sep 17 00:00:00 2001 From: claude_dev Date: Fri, 31 Jul 2026 13:35:19 +0800 Subject: [PATCH] =?UTF-8?q?feat(ci):=20CI=E5=8A=A0=E5=89=8D=E7=AB=AFbuild+?= =?UTF-8?q?=E9=83=A8=E7=BD=B2NAS=E9=97=AD=E7=8E=AF(nas-frontend=20job)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增 nas-frontend job(checkout→npm ci→npm run build→rsync dist 到 NAS homes/admin/frontend/dist),与 nas-smoke 并行;vps job 改 needs[nas-smoke,nas-frontend]。打通.vue 改动→push→CI 自动 build→NAS web 自动生效闭环(此前前端 dist 被 gitignore+promote.sh 无 frontend+workflow 无 build,CI 对前端完全断)。复用 Mac runner node v26/npm,HOME=/Users/chufeng 复用 ~/.npm cache。VPS 无 web 不部署前端。容器 bind mount homes/admin->/app,放挂载源即生效,无需改 Dockerfile。 --- .gitea/workflows/ci-cd.yml | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/ci-cd.yml b/.gitea/workflows/ci-cd.yml index 045a81c..b0ef386 100644 --- a/.gitea/workflows/ci-cd.yml +++ b/.gitea/workflows/ci-cd.yml @@ -48,9 +48,36 @@ jobs: print(\"dbbardata 600519 rows:\", n) exit(0 if n>0 else 1)'" + # ---------- 前端 build + 部署 NAS(与 nas-smoke 并行; VPS 无 web 不部署前端) ---------- + nas-frontend: + needs: test + runs-on: macos-arm64 + env: + HOME: /Users/chufeng + steps: + - name: checkout + env: + TOKEN: ${{ github.token }} + run: | + git init . + git config --local http.proxy "" + git config --local https.proxy "" + git remote add origin "http://oauth2:${TOKEN}@192.168.2.154:3000/${GITHUB_REPOSITORY}.git" + git fetch --depth 1 origin "${GITHUB_SHA}" + git checkout FETCH_HEAD + - name: build 前端 (node 在 /opt/homebrew/bin; npm ci 复用 HOME 的 ~/.npm cache) + run: | + export PATH="/opt/homebrew/bin:$PATH" + cd frontend + npm ci + npm run build + - name: 部署 dist 到 NAS (容器 bind mount homes/admin->/app; StaticFiles 实时读文件无需 restart) + run: | + rsync -az --delete frontend/dist/ sanguo-nas:/volume1/homes/admin/.sanguo_projects/sanguo_vnpy_v2/frontend/dist/ + # ---------- P3: VPS CD (prod gate) ---------- vps: - needs: nas-smoke + needs: [nas-smoke, nas-frontend] runs-on: macos-arm64 env: HOME: /Users/chufeng