From 994e81b1fb882e3630912efa55bd26a0b6f64bcb Mon Sep 17 00:00:00 2001 From: Abdulbari Date: Thu, 28 Aug 2025 18:47:24 +0300 Subject: [PATCH] Add sgeupdated pipeline --- .gitea/workflows/sgeupdated.yml | 63 +++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .gitea/workflows/sgeupdated.yml diff --git a/.gitea/workflows/sgeupdated.yml b/.gitea/workflows/sgeupdated.yml new file mode 100644 index 0000000..a4fa9e0 --- /dev/null +++ b/.gitea/workflows/sgeupdated.yml @@ -0,0 +1,63 @@ +# .gitea/workflows/sgeupdated.yml +name: sgeUpdated CI/CD + +on: + push: + branches: + - main # only trigger when code is merged to main + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + # 1. Checkout the repo + - name: Checkout repo + uses: actions/checkout@v3 + + # 2. Detect changed files + - name: Get changed files + id: changes + run: | + echo "CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD)" >> $GITHUB_ENV + + # 3. Connect to server via SSH and deploy + - 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: | + cd /path/to/your/project + git pull origin main + + # --- Backend --- + if echo "${CHANGED_FILES}" | grep -q "sgeUpdated-backend"; then + echo "Backend changes detected..." + cd sgeUpdated-backend + mvn clean install + cd .. + docker compose up -d --build backend + fi + + # --- Frontend --- + if echo "${CHANGED_FILES}" | grep -q "sgeUpdated-frontend"; then + echo "Frontend changes detected..." + cd sgeUpdated-frontend + if echo "${CHANGED_FILES}" | grep -q "sgeUpdated-frontend/package.json"; then + echo "package.json changed → installing dependencies" + npm install + fi + npm run build + cd .. + docker compose up -d --build frontend + fi + + # --- AyposWeb (if ever needed) --- + if echo "${CHANGED_FILES}" | grep -q "ayposWeb"; then + echo "AyposWeb changes detected..." + cd ayposWeb + npm run build + cd .. + docker compose up -d --build aypos + fi