From cd9e6773313a362b534f3a6334888aa9e0c1b3a3 Mon Sep 17 00:00:00 2001 From: JustMe Date: Thu, 8 Oct 2026 16:05:38 +0800 Subject: [PATCH] fix(ci): build the web apps once before the two backend architectures; release 0.3.1 [CI] --- .woodpecker/linux-release.yml | 17 +++++++++++++++-- backend/Directory.Build.props | 2 +- ci/release-linux.sh | 7 +++++-- web/package.json | 2 +- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.woodpecker/linux-release.yml b/.woodpecker/linux-release.yml index 727233a..5f2a2e3 100644 --- a/.woodpecker/linux-release.yml +++ b/.woodpecker/linux-release.yml @@ -15,6 +15,17 @@ when: concurrency: 1 steps: + # 前端只构建一次:两个架构的 Backend 构建并行跑在同一个工作目录里,各自 npm ci 会互相删 node_modules(ENOTEMPTY), + # 一个失败还会把另一个的构建进程一起杀掉。Backend 把 web/*/dist 内嵌进程序(展示端和管理端由面板自己提供)。 + - name: web-build + image: bash + environment: + NPM_CONFIG_CACHE: /home/justme/.npm + commands: + - npm ci --prefix web --prefer-offline + - npm run build --prefix web + depends_on: [] + - name: linux-amd64-backend image: bash environment: @@ -25,7 +36,8 @@ steps: from_secret: zot_secret commands: - bash ci/release-linux.sh amd64 backend - depends_on: [] + depends_on: + - web-build - name: linux-arm64-backend image: bash @@ -37,7 +49,8 @@ steps: from_secret: zot_secret commands: - bash ci/release-linux.sh arm64 backend - depends_on: [] + depends_on: + - web-build - name: backend-multiarch-index image: bash diff --git a/backend/Directory.Build.props b/backend/Directory.Build.props index ed79b1b..7c03aee 100644 --- a/backend/Directory.Build.props +++ b/backend/Directory.Build.props @@ -13,7 +13,7 @@ true $(MSBuildThisFileDirectory)artifacts true - 0.3.0 + 0.3.1 false diff --git a/ci/release-linux.sh b/ci/release-linux.sh index b71a684..2d403e3 100644 --- a/ci/release-linux.sh +++ b/ci/release-linux.sh @@ -53,8 +53,11 @@ export MOSHIRO_COMMIT="${MOSHIRO_COMMIT:-${CI_COMMIT_SHA:0:10}}" export MOSHIRO_BUILT_AT="${MOSHIRO_BUILT_AT:-$(date -u +%Y-%m-%dT%H:%M:%SZ)}" # 前端先构建:Backend.Api 在 web/*/dist 存在时把它们内嵌进程序(展示端 /,管理端 /admin/),这样 passkey 能绑定在面板自己的域名上 -if [[ -z "${NPM_CONFIG_CACHE:-}" && -d /home/justme/.npm ]]; then export NPM_CONFIG_CACHE=/home/justme/.npm; fi -(cd "$root" && npm ci --prefix web --prefer-offline && npm run build --prefix web) +# 发版流水线里有单独的 web-build 步骤先构建好了(并行的两个架构不能同时 npm ci);main 的 [CI] 构建只有一个 Backend 步骤,这里自己构建 +if [[ ! -f "$root/web/display/dist/index.html" || ! -f "$root/web/admin/dist/index.html" ]]; then + if [[ -z "${NPM_CONFIG_CACHE:-}" && -d /home/justme/.npm ]]; then export NPM_CONFIG_CACHE=/home/justme/.npm; fi + (cd "$root" && npm ci --prefix web --prefer-offline && npm run build --prefix web) +fi [[ -f "$root/web/display/dist/index.html" && -f "$root/web/admin/dist/index.html" ]] || { echo "the web build did not produce both apps" >&2; exit 1; } (cd "$root/backend" && dotnet publish src/MoShiro.Backend \ diff --git a/web/package.json b/web/package.json index 9cce86f..ccd3fc1 100644 --- a/web/package.json +++ b/web/package.json @@ -1,7 +1,7 @@ { "name": "moshiro-web", "private": true, - "version": "0.3.0", + "version": "0.3.1", "workspaces": [ "display", "admin"