fix: fixed release-offline.yml
This commit is contained in:
@@ -56,9 +56,32 @@ jobs:
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
toolchain_root="${MAIBOT_NODE_TOOLCHAIN_ROOT:-/srv/gitea-runner-maibot/toolchains/node}"
|
||||
if [ -d "$toolchain_root/bin" ]; then
|
||||
export PATH="$toolchain_root/bin:$PATH"
|
||||
fi
|
||||
|
||||
cd "$MAIBOT_WORKTREE/dashboard"
|
||||
npm ci
|
||||
|
||||
if command -v npm >/dev/null 2>&1; then
|
||||
npm_cache_dir="${MAIBOT_NPM_CACHE_DIR:-/srv/gitea-runner-maibot/npm-cache}"
|
||||
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
|
||||
|
||||
rm -rf dist
|
||||
mkdir -p dist
|
||||
tar -xzf "$dist_bundle" -C "$MAIBOT_WORKTREE/dashboard"
|
||||
fi
|
||||
|
||||
test -f dist/index.html
|
||||
|
||||
|
||||
Reference in New Issue
Block a user