ci: update deploy.yaml to deploy dashboard and identity-gateway only
This commit is contained in:
parent
a52bd4519d
commit
3a236a250a
1 changed files with 30 additions and 39 deletions
|
|
@ -1,20 +1,17 @@
|
||||||
name: Deploy Stack (Dev)
|
name: Deploy Core (Dashboard & Identity Gateway)
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- dev
|
- dev
|
||||||
paths:
|
paths:
|
||||||
- 'backend/**'
|
- 'dashboard/**'
|
||||||
- 'backoffice/**'
|
- 'identity-gateway/**'
|
||||||
- 'frontend/**'
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: rg.fr-par.scw.cloud/funcscwinfrastructureascodehdz4uzhb
|
REGISTRY: rg.fr-par.scw.cloud/yumi
|
||||||
NAMESPACE: a5034510-9763-40e8-ac7e-1836e7a61460
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Job: Deploy no Servidor (Pull das imagens do Scaleway)
|
|
||||||
deploy-dev:
|
deploy-dev:
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -26,20 +23,15 @@ jobs:
|
||||||
- name: Check changed files
|
- name: Check changed files
|
||||||
id: check
|
id: check
|
||||||
run: |
|
run: |
|
||||||
if git diff --name-only HEAD~1 HEAD | grep -q "^backend/"; then
|
if git diff --name-only HEAD~1 HEAD | grep -q "^dashboard/"; then
|
||||||
echo "backend=true" >> $GITHUB_OUTPUT
|
echo "dashboard=true" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
echo "backend=false" >> $GITHUB_OUTPUT
|
echo "dashboard=false" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
if git diff --name-only HEAD~1 HEAD | grep -q "^frontend/"; then
|
if git diff --name-only HEAD~1 HEAD | grep -q "^identity-gateway/"; then
|
||||||
echo "frontend=true" >> $GITHUB_OUTPUT
|
echo "identity-gateway=true" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
echo "frontend=false" >> $GITHUB_OUTPUT
|
echo "identity-gateway=false" >> $GITHUB_OUTPUT
|
||||||
fi
|
|
||||||
if git diff --name-only HEAD~1 HEAD | grep -q "^backoffice/"; then
|
|
||||||
echo "backoffice=true" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
echo "backoffice=false" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Deploy via SSH
|
- name: Deploy via SSH
|
||||||
|
|
@ -53,30 +45,29 @@ jobs:
|
||||||
# Login no Scaleway Registry
|
# Login no Scaleway Registry
|
||||||
echo "${{ secrets.SCW_SECRET_KEY }}" | podman login ${{ env.REGISTRY }} -u nologin --password-stdin
|
echo "${{ secrets.SCW_SECRET_KEY }}" | podman login ${{ env.REGISTRY }} -u nologin --password-stdin
|
||||||
|
|
||||||
# --- DEPLOY DO BACKEND ---
|
# --- DEPLOY DASHBOARD ---
|
||||||
if [ "${{ steps.check.outputs.backend }}" == "true" ]; then
|
if [ "${{ steps.check.outputs.dashboard }}" == "true" ]; then
|
||||||
echo "Pulling e reiniciando Backend..."
|
echo "🚀 Deploying Dashboard..."
|
||||||
podman pull ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/backend:dev-latest
|
podman pull ${{ env.REGISTRY }}/dashboard:latest
|
||||||
podman tag ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/backend:dev-latest localhost/gohorsejobs-backend-dev:latest
|
# Stop ancient container if exists
|
||||||
sudo systemctl restart gohorsejobs-backend-dev
|
podman stop dashboard || true
|
||||||
|
podman rm dashboard || true
|
||||||
|
# Run new container
|
||||||
|
podman run -d --name dashboard -p 3000:3000 --restart always ${{ env.REGISTRY }}/dashboard:latest
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# --- DEPLOY DO FRONTEND ---
|
# --- DEPLOY IDENTITY GATEWAY ---
|
||||||
if [ "${{ steps.check.outputs.frontend }}" == "true" ]; then
|
if [ "${{ steps.check.outputs.identity-gateway }}" == "true" ]; then
|
||||||
echo "Pulling e reiniciando Frontend..."
|
echo "🚀 Deploying Identity Gateway..."
|
||||||
podman pull ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/frontend:dev-latest
|
podman pull ${{ env.REGISTRY }}/identity-gateway:latest
|
||||||
podman tag ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/frontend:dev-latest localhost/gohorsejobs-frontend-dev:latest
|
# Stop ancient container if exists
|
||||||
sudo systemctl restart gohorsejobs-frontend-dev
|
podman stop identity-gateway || true
|
||||||
fi
|
podman rm identity-gateway || true
|
||||||
|
# Run new container (assuming env from host or .env file mapping needed)
|
||||||
# --- DEPLOY DO BACKOFFICE ---
|
# NOTE: You might need to map .env file: --env-file /path/to/.env
|
||||||
if [ "${{ steps.check.outputs.backoffice }}" == "true" ]; then
|
podman run -d --name identity-gateway -p 4000:4000 --restart always ${{ env.REGISTRY }}/identity-gateway:latest
|
||||||
echo "Pulling e reiniciando Backoffice..."
|
|
||||||
podman pull ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/backoffice:dev-latest
|
|
||||||
podman tag ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/backoffice:dev-latest localhost/gohorsejobs-backoffice-dev:latest
|
|
||||||
sudo systemctl restart gohorsejobs-backoffice-dev
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# --- LIMPEZA ---
|
# --- LIMPEZA ---
|
||||||
echo "Limpando imagens antigas..."
|
echo "🧹 Pruning old images..."
|
||||||
podman image prune -f || true
|
podman image prune -f || true
|
||||||
Loading…
Reference in a new issue