mirror of
https://github.com/nethunterzist/trendyol-analiz
synced 2026-07-01 01:17:04 +00:00
Ne yaptik: - Frontend build arg guncellendi: sslip.io -> ciromarket.cironet.com.tr Neden yaptik: - Let's Encrypt sslip.io rate limit (250k/168h), gercek domain kullaniyoruz - Yeni frontend image bu URL ile build edilecek, ArgoCD sync'leyecek
79 lines
2.5 KiB
YAML
79 lines
2.5 KiB
YAML
name: ciromarket-frontend-build-and-deploy
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- 'admin-panel/**'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
REGISTRY: git.novasis.tr
|
|
IMAGE: admin/trendyol-analiz/frontend
|
|
DOCKER_HOST: tcp://172.17.0.1:2375
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Compute tag
|
|
id: tag
|
|
run: echo "sha=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Pre-build disk check
|
|
run: |
|
|
df -h /var/lib/docker || df -h /
|
|
docker system df || true
|
|
|
|
- name: Login to Gitea registry
|
|
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login "$REGISTRY" -u admin --password-stdin
|
|
|
|
- name: Build & push image
|
|
run: |
|
|
docker build \
|
|
--file admin-panel/Dockerfile \
|
|
--build-arg VITE_API_URL=https://ciromarket.cironet.com.tr \
|
|
--tag "$REGISTRY/$IMAGE:${{ steps.tag.outputs.sha }}" \
|
|
--tag "$REGISTRY/$IMAGE:latest" \
|
|
./admin-panel
|
|
docker push "$REGISTRY/$IMAGE:${{ steps.tag.outputs.sha }}"
|
|
docker push "$REGISTRY/$IMAGE:latest"
|
|
|
|
- name: Bump deployment manifest in ci-cd repo
|
|
run: |
|
|
set -euo pipefail
|
|
git clone https://gitea_admin:${{ secrets.CI_CD_TOKEN }}@git.novasis.tr/gitea_admin/ci-cd.git /tmp/ci-cd
|
|
cd /tmp/ci-cd
|
|
git config user.email "ci@novasis.tr"
|
|
git config user.name "gitea-actions-bot"
|
|
MANIFEST="apps/ciromarket/frontend/deploy/deployment.yaml"
|
|
MAX=5
|
|
for i in $(seq 1 $MAX); do
|
|
git fetch origin main
|
|
git reset --hard origin/main
|
|
sed -i -E "s|image: ${REGISTRY}/${IMAGE}:.*|image: ${REGISTRY}/${IMAGE}:${{ steps.tag.outputs.sha }}|" "$MANIFEST"
|
|
if git diff --quiet "$MANIFEST"; then
|
|
echo "No image change to commit."
|
|
exit 0
|
|
fi
|
|
git add "$MANIFEST"
|
|
git commit -m "ci: bump ciromarket/frontend to ${{ steps.tag.outputs.sha }} [skip ci]"
|
|
if git push origin main; then
|
|
echo "Pushed on attempt $i"
|
|
exit 0
|
|
fi
|
|
sleep 3
|
|
done
|
|
exit 1
|
|
|
|
- name: Post-build cleanup
|
|
if: always()
|
|
run: |
|
|
docker buildx prune --force --keep-storage 3GB 2>&1 | tail -3 || true
|
|
docker image prune -f 2>&1 | tail -2 || true
|