forked from BLC/sgeUpdated
Add sgeupdated pipeline
This commit is contained in:
63
.gitea/workflows/sgeupdated.yml
Normal file
63
.gitea/workflows/sgeupdated.yml
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user