sozsoft-platform/configs/deployment/scripts/build/api.sh
2026-08-13 13:43:48 +03:00

45 lines
2 KiB
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: sürüm notu üretimi sessizce başarısız olursa imaj eski/eksik notlarla
# derlenmesin. Daha önce böyle olmuştu: dosya git'te takip edildiği için hata
# fark edilmiyordu.
set -e
cd ~/sozsoft-platform
git checkout main
# --tags --force: sürüm notları git tag'lerinden üretiliyor; yerel tag origin'den
# farklı commit'e bakıyorsa --force olmadan reddedilir ve yeni tag'ler gelmez.
git fetch --prune --prune-tags --tags --force && git pull
cd ~/sozsoft-platform/api
# Sürüm notları git tag'lerinden üretilir ve API imajına gömülür; uygulama
# açılışta bunları veritabanına senkronize eder (DbMigrator gerekmez).
# `bash ...` ile çağrılır: depo Windows'tan yönetildiği için çalıştırma bitinin
# kaybolması "Permission denied" verip sürüm notlarını sessizce düşürüyordu.
RELEASE_NOTES=src/Sozsoft.Platform.HttpApi.Host/release-notes.json
bash scripts/generate-release-notes.sh
# Dosya publish çıktısına csproj üzerinden girer; yoksa imaj sürüm notsuz kalır
# ve API açılışta "release-notes.json bulunamadı" uyarısı verir. Sessizce devam
# etmek yerine burada dur.
if [ ! -s "$RELEASE_NOTES" ]; then
echo "HATA: ${RELEASE_NOTES} üretilemedi, imaj derlenmiyor." >&2
exit 1
fi
VERSION=$(cat ~/sozsoft-platform/api/src/Sozsoft.Platform.HttpApi.Host/appsettings.json \
| grep -o '"[^"]*"\s*:\s*"[^"]*"' \
| grep -E '^"(Version)"' \
| sed 's/^.* //' \
| sed 's/"//g')
# DevExpress lisansını dosyadan oku (GitHub'a commit edilmemiş)
DEVEXPRESS_LICENSE=$(cat ~/sozsoft-platform/api/DevExpress_License.txt 2>/dev/null || echo "")
docker build \
--build-arg DevExpress_License="${DEVEXPRESS_LICENSE}" \
-t devops.sozsoft.com/sozsoft/sozsoft-platform-api:${VERSION} \
-t devops.sozsoft.com/sozsoft/sozsoft-platform-api:latest \
-f Sozsoft.Platform.HttpApi.Host.Dockerfile .
docker push devops.sozsoft.com/sozsoft/sozsoft-platform-api:${VERSION}
docker push devops.sozsoft.com/sozsoft/sozsoft-platform-api:latest