Files
trendyol-analiz/.gitea/workflows/deploy-frontend.yaml
furkanyigit34 eb679300f3 ci(k8s): Gitea K8s pipeline ekle — CiroMarket K8s migration
Ne yaptık:
- .gitea/workflows/deploy-backend.yaml — Gitea Actions ile backend image'ı build et, Gitea registry'e push et, ci-cd repo manifest'ini bump'la
- .gitea/workflows/deploy-frontend.yaml — Frontend'i VITE_API_URL=https://trendyol-api.194.187.253.61.sslip.io ile build et, aynı pattern
- .github/workflows/deploy.yml — sync-gitea job eklendi: GitHub push sonrası Gitea mirror sync + deploy-backend/frontend.yaml dispatch

Neden yaptık:
- CiroMarket'i Coolify'dan K8s'e taşıma projesi
- Coolify pipeline parallel çalışmaya devam ediyor (zero downtime)
- GitHub push → Gitea mirror → Gitea Actions → Gitea registry → ArgoCD → K8s rolling update zinciri tamamlandı
2026-05-18 11:42:02 +03:00

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://trendyol-api.194.187.253.61.sslip.io \
--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