56 lines
1.5 KiB
Bash
Executable File
56 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
# Build hyprcrd distribution ZIP with version bump
|
|
set -e
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
# Read current version
|
|
CURRENT=$(grep "APP_VERSION" config.php | grep -oP "'[^']+'" | tail -1 | tr -d "'")
|
|
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT"
|
|
|
|
# Bump: --major, --minor, or patch (default)
|
|
case "${1:-patch}" in
|
|
--major) MAJOR=$((MAJOR + 1)); MINOR=0; PATCH=0 ;;
|
|
--minor) MINOR=$((MINOR + 1)); PATCH=0 ;;
|
|
*) PATCH=$((PATCH + 1)) ;;
|
|
esac
|
|
|
|
VERSION="${MAJOR}.${MINOR}.${PATCH}"
|
|
sed -i "s/APP_VERSION', '${CURRENT}'/APP_VERSION', '${VERSION}'/" config.php
|
|
echo "Version: ${CURRENT} → ${VERSION}"
|
|
|
|
DIST="hyprcrd-${VERSION}.zip"
|
|
|
|
# Rebuild Tailwind if CLI exists
|
|
if [ -x ./tailwindcss ]; then
|
|
echo "Building Tailwind CSS..."
|
|
./tailwindcss --input public/css/tailwind.css --output public/css/tailwind.out.css --content "public/index.php,public/js/**/*.js" --minify
|
|
fi
|
|
|
|
echo "Creating ${DIST}..."
|
|
|
|
zip -r "$DIST" \
|
|
config.php \
|
|
Dockerfile \
|
|
docker-entrypoint.sh \
|
|
README.md \
|
|
dist.sh \
|
|
.gitignore \
|
|
src/ \
|
|
public/ \
|
|
-x "public/uploads/*" \
|
|
-x "public/uploads/.gitkeep" \
|
|
-x "public/css/tailwind.css"
|
|
|
|
# Add empty dirs with gitkeep
|
|
mkdir -p /tmp/hyprcrd-dist/data
|
|
mkdir -p /tmp/hyprcrd-dist/public/uploads
|
|
touch /tmp/hyprcrd-dist/data/.gitkeep
|
|
touch /tmp/hyprcrd-dist/public/uploads/.gitkeep
|
|
cd /tmp/hyprcrd-dist
|
|
zip -r "$OLDPWD/$DIST" data/.gitkeep public/uploads/.gitkeep
|
|
cd "$OLDPWD"
|
|
rm -rf /tmp/hyprcrd-dist
|
|
|
|
echo "Done: ${DIST} ($(du -h "$DIST" | cut -f1))"
|