29 lines
1.1 KiB
Bash
29 lines
1.1 KiB
Bash
#!/bin/bash
|
||
export ENV=${1:-dev}
|
||
echo "Env değeri: ${ENV}"
|
||
|
||
cd ~/sozsoft-platform
|
||
git checkout main
|
||
# --prune-tags: sunucuda elle atılmış, origin'de olmayan yerel tag'leri siler.
|
||
# Bunlar temizlenmezse `git tag` listesinde kalır ve deploy yanlış (daha yüksek)
|
||
# bir sürüm numarasıyla etiketlenir.
|
||
git fetch --prune --prune-tags --tags && git pull
|
||
|
||
cd ~/sozsoft-platform/ui
|
||
|
||
# Sürüm, HEAD'den erişilebilen son tag'dir (başka daldaki tag'ler sayılmaz);
|
||
# tag yoksa package.json'daki sürüm kullanılır.
|
||
VERSION=$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//')
|
||
VERSION=${VERSION:-$(jq -r .version package.json)}
|
||
echo "Build versiyonu: ${VERSION}"
|
||
|
||
# Deploy öncesi git üzerindeki tüm versiyon bilgilerini güncelle
|
||
./scripts/generate-version.sh
|
||
|
||
docker build \
|
||
-t devops.sozsoft.com/sozsoft/sozsoft-platform-ui:${ENV}-${VERSION} \
|
||
-t devops.sozsoft.com/sozsoft/sozsoft-platform-ui:${ENV}-latest \
|
||
-f Sozsoft.Platform.Ui.Dockerfile --build-arg ENV=${ENV} .
|
||
|
||
docker push devops.sozsoft.com/sozsoft/sozsoft-platform-ui:${ENV}-${VERSION}
|
||
docker push devops.sozsoft.com/sozsoft/sozsoft-platform-ui:${ENV}-latest
|