-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathdeploy-docusaurus-build.sh
More file actions
executable file
·45 lines (36 loc) · 1.06 KB
/
deploy-docusaurus-build.sh
File metadata and controls
executable file
·45 lines (36 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env bash
set -euo pipefail
BUILD_DIR="build"
TARGET_DIR="."
[[ -d "$BUILD_DIR" ]] || {
echo "No build/ directory found"
exit 1
}
echo "Cleaning old Docusaurus JS/CSS assets..."
# Удаляем только хешированные docusaurus *.js
if [[ -d "$TARGET_DIR/assets/js" ]]; then
find "$TARGET_DIR/assets/js" -maxdepth 1 -type f \
| while IFS= read -r file; do
name="$(basename "$file")"
if [[ "$name" =~ \.[a-f0-9]{8,}\.js$ ]]; then
echo "Removing $file"
rm -f "$file"
fi
done
fi
# Удаляем только хешированные docusaurus *.css
if [[ -d "$TARGET_DIR/assets/css" ]]; then
find "$TARGET_DIR/assets/css" -maxdepth 1 -type f \
| while IFS= read -r file; do
name="$(basename "$file")"
if [[ "$name" =~ \.[a-f0-9]{8,}\.css$ ]]; then
echo "Removing $file"
rm -f "$file"
fi
done
fi
echo "Copying new build without touching sitemap.xml..."
rsync -a \
--exclude='sitemap.xml' \
"$BUILD_DIR"/ "$TARGET_DIR"/
echo "Done"