erp-platform/ui/scripts/generate-version.sh

35 lines
752 B
Bash
Raw Normal View History

2025-09-22 18:53:03 +00:00
#!/bin/bash
set -e
echo "> version.json oluşturuluyor..."
2025-09-22 19:16:02 +00:00
# En yeni tag en üstte olsun
VERSIONS=$(git tag --sort=-creatordate)
2025-09-22 18:53:03 +00:00
OUTPUT="{\"releases\":["
FIRST=true
for TAG in $VERSIONS; do
VER=$(echo $TAG | sed 's/^v//')
DATE=$(git log -1 --format=%ad --date=short $TAG)
COMMIT=$(git rev-list -n 1 $TAG)
2025-09-22 19:16:02 +00:00
# 🔑 Boş satırları filtrele
MESSAGE=$(git tag -l --format="%(contents)" $TAG | grep -v '^$' | jq -R . | jq -s .)
2025-09-22 18:53:03 +00:00
if [ "$FIRST" = true ]; then
FIRST=false
else
OUTPUT+=","
fi
OUTPUT+="{\"version\":\"$VER\",\"buildDate\":\"$DATE\",\"commit\":\"$COMMIT\",\"changeLog\":$MESSAGE}"
done
OUTPUT+="]}"
echo "$OUTPUT" | jq . > public/version.json
echo "> public/version.json güncellendi:"
cat public/version.json