push master

pull/882/head
chanhengseang 2025-05-26 16:22:27 -07:00
parent 1c66411d5d
commit 3ef96bbd73
1 changed files with 11 additions and 9 deletions

View File

@ -2,7 +2,9 @@ name: Maven Build
on:
push:
branches: [ '*' ]
branches:
- '*' # This runs on all branches for the build job
- 'master' # Explicitly include master
jobs:
build:
@ -31,10 +33,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Setup SSH
uses: webfactory/ssh-agent@v0.7.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Install sshpass
run: sudo apt-get install -y sshpass
- name: Add server to known hosts
run: |
@ -42,9 +42,11 @@ jobs:
ssh-keyscan -H 172.235.32.135 >> ~/.ssh/known_hosts
- name: Deploy to server
env:
SSH_PASSWORD: ${{ secrets.SSH_PASSWORD }}
run: |
ssh ubuntu@172.235.32.135 "cd backend && \
sshpass -p "$SSH_PASSWORD" ssh root@172.235.32.135 "cd backend && \
pkill -f 'java -jar' || true && \
git pull && \
./mvnw clean package && \
nohup java -jar target/*.jar > app.log 2>&1 &"
nohup java -jar eladmin-system/target/eladmin-system-2.7.jar > app.log 2>&1 &"