-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·50 lines (44 loc) · 1.32 KB
/
build.sh
File metadata and controls
executable file
·50 lines (44 loc) · 1.32 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
#!/bin/bash
# Set up colors for console output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Function to print colored output
print_colored() {
color=$1
message=$2
echo -e "${color}${message}${NC}"
}
# Set variables
DIST_DIR="dist"
FILE_NAME="sd-wp"
# Remove existing zip file
if [ -f "$FILE_NAME.zip" ]; then
print_colored $YELLOW "Removing existing zip file..."
rm $FILE_NAME.zip
fi
# Create zip archive
print_colored $YELLOW "Creating zip archive..."
cd $DIST_DIR
if command -v zip &> /dev/null; then
# Use zip if available (Linux/macOS)
if zip -r ../$FILE_NAME.zip .; then
print_colored $GREEN "Zip archive created successfully."
else
print_colored $RED "Error creating zip archive. Exiting."
exit 1
fi
else
# Fall back to PowerShell Compress-Archive on Windows
print_colored $YELLOW "zip command not found, using PowerShell Compress-Archive..."
if powershell.exe -Command "Compress-Archive -Path * -DestinationPath ../$FILE_NAME.zip"; then
print_colored $GREEN "Zip archive created successfully."
else
print_colored $RED "Error creating zip archive. Exiting."
exit 1
fi
fi
cd ..
print_colored $GREEN "Build process completed successfully!"
print_colored $YELLOW "Plugin zip file: $FILE_NAME.zip"