Files
sgeUpdated/.gitea/workflows/sgeupdated.yml

49 lines
1.3 KiB
YAML

# .gitea/workflows/sgeupdated.yml
name: sgeUpdated CI/CD
on:
push:
branches:
- main # trigger only when code is merged into main
workflow_dispatch: # allow manual trigger
concurrency:
group: sgeupdated-deploy-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Deploy over SSH
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script_stop: true
script: |
set -euo pipefail
cd /home/ubuntu/Bgreen/sgeUpdated
git fetch origin main
git reset --hard origin/main
echo "⚡ Rebuilding Backend..."
cd sge-backend
/opt/apache-maven-3.9.11/bin/mvn clean install -DskipTests
cd ../..
docker compose up -d --build backend
echo "⚡ Rebuilding Frontend..."
cd sge-frontend
# npm install
# npm run build
cd ../..
docker compose up -d --build frontend
echo "✅ Deployment complete. Current containers:"
docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}'