From 56a07e1fe9cb574967b74732e531c4ff824b7748 Mon Sep 17 00:00:00 2001 From: LoveLosita <2810873701@qq.com> Date: Tue, 12 May 2026 14:41:13 +0800 Subject: [PATCH] fix(release): fallback to prebuilt dashboard bundle in offline workflow --- .gitea/workflows/release-offline.yml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/release-offline.yml b/.gitea/workflows/release-offline.yml index 08b90f0b..aef54da4 100644 --- a/.gitea/workflows/release-offline.yml +++ b/.gitea/workflows/release-offline.yml @@ -57,6 +57,9 @@ jobs: set -euo pipefail toolchain_root="${MAIBOT_NODE_TOOLCHAIN_ROOT:-/srv/gitea-runner-maibot/toolchains/node}" + dist_bundle_root="${MAIBOT_PREBUILT_DASHBOARD_ROOT:-/srv/gitea-runner-maibot/prebuilt-dashboard}" + dist_bundle="${dist_bundle_root}/${MAIBOT_REPO_SHA}.tar.gz" + if [ -d "$toolchain_root/bin" ]; then export PATH="$toolchain_root/bin:$PATH" fi @@ -68,21 +71,21 @@ jobs: mkdir -p "$npm_cache_dir" npm ci --cache "$npm_cache_dir" npm run build - else - dist_bundle_root="${MAIBOT_PREBUILT_DASHBOARD_ROOT:-/srv/gitea-runner-maibot/prebuilt-dashboard}" - dist_bundle="${dist_bundle_root}/${MAIBOT_REPO_SHA}.tar.gz" - - if [ ! -f "$dist_bundle" ]; then - echo "npm is not available and no prebuilt dashboard bundle was found: $dist_bundle" >&2 - echo "Either install an offline Node.js toolchain under $toolchain_root or upload a prebuilt dist bundle for commit $MAIBOT_REPO_SHA." >&2 - exit 127 - fi + fi + if [ ! -f dist/index.html ] && [ -f "$dist_bundle" ]; then + echo "Using prebuilt dashboard bundle: $dist_bundle" rm -rf dist mkdir -p dist tar -xzf "$dist_bundle" -C "$MAIBOT_WORKTREE/dashboard" fi + if [ ! -f dist/index.html ]; then + echo "dashboard build output not found: $MAIBOT_WORKTREE/dashboard/dist/index.html" >&2 + echo "Provide a working offline npm toolchain or upload a prebuilt dashboard bundle to $dist_bundle." >&2 + exit 127 + fi + test -f dist/index.html - name: Stage release directory