fix(release): fallback to prebuilt dashboard bundle in offline workflow
This commit is contained in:
@@ -57,6 +57,9 @@ jobs:
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
toolchain_root="${MAIBOT_NODE_TOOLCHAIN_ROOT:-/srv/gitea-runner-maibot/toolchains/node}"
|
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
|
if [ -d "$toolchain_root/bin" ]; then
|
||||||
export PATH="$toolchain_root/bin:$PATH"
|
export PATH="$toolchain_root/bin:$PATH"
|
||||||
fi
|
fi
|
||||||
@@ -68,21 +71,21 @@ jobs:
|
|||||||
mkdir -p "$npm_cache_dir"
|
mkdir -p "$npm_cache_dir"
|
||||||
npm ci --cache "$npm_cache_dir"
|
npm ci --cache "$npm_cache_dir"
|
||||||
npm run build
|
npm run build
|
||||||
else
|
fi
|
||||||
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
|
|
||||||
|
|
||||||
|
if [ ! -f dist/index.html ] && [ -f "$dist_bundle" ]; then
|
||||||
|
echo "Using prebuilt dashboard bundle: $dist_bundle"
|
||||||
rm -rf dist
|
rm -rf dist
|
||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
tar -xzf "$dist_bundle" -C "$MAIBOT_WORKTREE/dashboard"
|
tar -xzf "$dist_bundle" -C "$MAIBOT_WORKTREE/dashboard"
|
||||||
fi
|
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
|
test -f dist/index.html
|
||||||
|
|
||||||
- name: Stage release directory
|
- name: Stage release directory
|
||||||
|
|||||||
Reference in New Issue
Block a user