Skip to content

Commit

Permalink
Update deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
XyL1GaN4eG committed Jul 17, 2024
1 parent de45173 commit 12cb385
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,14 @@ jobs:
- name: Debug environment variables
run: printenv

- name: Build userService
run: mvn -e -X -B package --file userService/pom.xml

- name: Deploy userService to Server
- name: Deploy project files to server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
source: 'userService/target/*.jar'
target: '/home/xyl1gan4eg/myJavaProjects/weatherProject/userService/userService.jar'
source: '.'
target: '/home/xyl1gan4eg/myJavaProjects/weatherProject'
port: 22
timeout: 30s
command_timeout: 10m
Expand All @@ -53,15 +50,17 @@ jobs:
proxy_timeout: 30s
proxy_use_insecure_cipher: false

- name: SSH into server and restart userService
- name: SSH into server, build and restart userService
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd /home/xyl1gan4eg/myJavaProjects/weatherProject
mvn clean package --file userService/pom.xml
if sudo systemctl is-active --quiet user-service; then
sudo systemctl stop user-service
fi
sudo cp /home/xyl1gan4eg/myJavaProjects/weatherProject/userService/userService.jar /opt/userService/
sudo cp /home/xyl1gan4eg/myJavaProjects/weatherProject/userService/target/userService.jar /opt/userService/
sudo systemctl start user-service

0 comments on commit 12cb385

Please sign in to comment.