fix(deploy): retain current web assets before release

This commit is contained in:
Xiaoxia AI
2026-06-23 18:48:13 +08:00
parent efa86088b8
commit 72efc7cedb
2 changed files with 5 additions and 1 deletions
+4 -1
View File
@@ -182,8 +182,11 @@ jobs:
mkdir -p /var/lib/xiaoxia-saas-production
old_assets_dir="/tmp/xiaoxia-previous-web-assets-${RELEASE_VERSION}"
rm -rf "$old_assets_dir"
mkdir -p "$old_assets_dir"
if docker inspect xiaoxia-web-production >/dev/null 2>&1; then
docker cp xiaoxia-web-production:/usr/share/nginx/html/assets/. "$old_assets_dir"/ 2>/dev/null || true
fi
if [ -d /var/lib/xiaoxia-saas-production/repo/apps/web/dist/assets ]; then
mkdir -p "$old_assets_dir"
cp -a /var/lib/xiaoxia-saas-production/repo/apps/web/dist/assets/. "$old_assets_dir"/
fi
rm -rf /var/lib/xiaoxia-saas-production/repo
+1
View File
@@ -59,6 +59,7 @@ def test_production_workflow_preserves_previous_web_assets():
production_section = workflow.split("deploy-production:", 1)[1]
assert "old_assets_dir=\"/tmp/xiaoxia-previous-web-assets-${RELEASE_VERSION}\"" in production_section
assert "docker cp xiaoxia-web-production:/usr/share/nginx/html/assets/. \"$old_assets_dir\"/" in production_section
assert "cp -a /var/lib/xiaoxia-saas-production/repo/apps/web/dist/assets/. \"$old_assets_dir\"/" in production_section
assert "if [ ! -e \"/var/lib/xiaoxia-saas-production/repo/apps/web/dist/assets/$name\" ]; then" in production_section