-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·57 lines (50 loc) · 1.65 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·57 lines (50 loc) · 1.65 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
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
if [ "$PARTIAL_BUILD" != "true" ]; then
npm install
# Check for missing translations
echo "Checking for missing translations..."
node src/check-translations.js
translation_check_result=$?
if [ $translation_check_result -ne 0 ]; then
echo "Missing translations detected. Running automated translation..."
# Run translation
node src/translate-with-gpt.js
if [ $? -ne 0 ]; then
echo "Build failed: Translation failed"
exit 1
fi
# Check if there are changes to commit
if [ -n "$(git status --porcelain src/content src/translation-cache.json 2>/dev/null)" ]; then
echo "Committing translation changes..."
git add -A src/content
git add src/translation-cache.json
git commit -m "Automated translation update"
echo "Translation changes committed."
echo "Pushing translation changes..."
git push
echo "Translation changes pushed."
else
echo "No translation changes to commit."
fi
else
echo "All translations up to date."
fi
# Check for invalid categories in translated posts
echo "Checking for invalid categories..."
node src/check-categories.js
if [ $? -ne 0 ]; then
echo "Build failed: Invalid categories found in translated posts"
exit 1
fi
mkdir -p src/static/generated/
node src/app
if [ $? -ne 0 ]; then
echo "Build failed: site generation (src/app) errored"
exit 1
fi
cp -rv src/static/css src/static/generated/
cp -rv src/static/images src/static/generated/
cp -rv src/static/js src/static/generated/
cp -rv src/static/image-compare src/static/generated/
cp src/static/*.html src/static/generated/
fi