erp-platform/ui/scripts/generate-version.sh
2025-09-23 11:32:04 +03:00

35 lines
823 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
set -e
echo "> version.json oluşturuluyor..."
# En yeni tag en üstte olsun
VERSIONS=$(git tag --sort=-creatordate)
ROOT_COMMIT=$(git rev-parse --short HEAD)
OUTPUT="{\"commit\":\"$ROOT_COMMIT\",\"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)
# 🔑 Boş satırları filtrele
MESSAGE=$(git tag -l --format="%(contents)" $TAG | grep -v '^$' | jq -R . | jq -s .)
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