fix(deploy): retain current web assets before release
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user