-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·83 lines (67 loc) · 2.55 KB
/
build.sh
File metadata and controls
executable file
·83 lines (67 loc) · 2.55 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
ZIP_NAME="boopixel-ai-chat-for-n8n.zip"
# Function to increment version (patch version)
increment_version() {
local version=$1
IFS='.' read -ra ADDR <<< "$version"
local major=${ADDR[0]}
local minor=${ADDR[1]}
local patch=${ADDR[2]}
patch=$((patch + 1))
echo "$major.$minor.$patch"
}
# Get current version from boopixel-ai-chat-for-n8n.php
CURRENT_VERSION=$(grep "Version:" boopixel-ai-chat-for-n8n.php | head -1 | sed -E 's/.*Version: ([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
if [ -z "$CURRENT_VERSION" ]; then
CURRENT_VERSION="1.0.0"
fi
# Increment version
NEW_VERSION=$(increment_version "$CURRENT_VERSION")
echo "Updating version from $CURRENT_VERSION to $NEW_VERSION"
# Update version in boopixel-ai-chat-for-n8n.php (header and constant)
sed -i.bak "s/Version: $CURRENT_VERSION/Version: $NEW_VERSION/g" boopixel-ai-chat-for-n8n.php
sed -i.bak "s/define('BOOPIXEL_AI_CHAT_FOR_N8N_VERSION', '$CURRENT_VERSION');/define('BOOPIXEL_AI_CHAT_FOR_N8N_VERSION', '$NEW_VERSION');/g" boopixel-ai-chat-for-n8n.php
# Update version in package.json
sed -i.bak "s/\"version\": \"$CURRENT_VERSION\"/\"version\": \"$NEW_VERSION\"/g" package.json
# Update version in README.md
sed -i.bak "s/Current version: \*\*$CURRENT_VERSION\*\*/Current version: **$NEW_VERSION**/g" README.md
# Update version in README.txt
sed -i.bak "s/Stable tag: $CURRENT_VERSION/Stable tag: $NEW_VERSION/g" README.txt
# Remove backup files
rm -f boopixel-ai-chat-for-n8n.php.bak package.json.bak README.md.bak README.txt.bak
echo "Version updated to $NEW_VERSION"
# Compile .mo files from .po files if msgfmt is available
if command -v msgfmt &> /dev/null; then
echo "Compiling translation files..."
cd languages
for po_file in *.po; do
if [ -f "$po_file" ]; then
mo_file="${po_file%.po}.mo"
msgfmt -o "$mo_file" "$po_file" 2>/dev/null && echo " Compiled: $mo_file" || echo " Warning: Failed to compile $po_file"
fi
done
cd ..
else
echo "Warning: msgfmt not found. .mo files will not be compiled."
echo "Install gettext package to compile translation files."
fi
# Create ZIP
[ -f "$ZIP_NAME" ] && rm "$ZIP_NAME"
zip -r "$ZIP_NAME" . \
-x "*.git*" \
-x "*.DS_Store*" \
-x "*__MACOSX*" \
-x "*.zip" \
-x "build.sh" \
-x ".gitignore" \
-x "README.md" \
-x "*.md" \
-x "*.bak*" \
-x "*backup*" \
-x "tests/*" \
-x "phpunit.xml" \
-x "composer.json" \
-x "package.json" \
-x "node_modules/*" \
> /dev/null 2>&1
echo "Build complete: $ZIP_NAME (version $NEW_VERSION)"