Update application.yml #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to Ubuntu Server | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'temurin' # или 'zulu', 'adopt', 'corretto' | |
java-version: '17' | |
- name: Build userService | |
run: mvn -e -B package --file userService/pom.xml | |
# - name: Build anotherService | |
# run: mvn -B package --file /path/to/anotherService/pom.xml | |
- name: Deploy userService to Server | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.SERVER_SSH_KEY }} | |
source: 'userService/target/*.jar' | |
target: '/home/xyl1gan4eg/myJavaProjects/weatherProject/userService' | |
# - name: Deploy anotherService to Server | |
# uses: appleboy/scp-action@master | |
# with: | |
# host: ${{ secrets.SERVER_HOST }} | |
# username: ${{ secrets.SERVER_USERNAME }} | |
# key: ${{ secrets.SERVER_SSH_KEY }} | |
# source: '/path/to/anotherService/target/*.jar' | |
# target: '/home/xyl1gan4eg/myJavaProjects/weatherProject/anotherService' | |
- name: SSH into server and restart userService | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.SERVER_SSH_KEY }} | |
script: | | |
sudo systemctl stop userService | |
sudo cp /home/xyl1gan4eg/myJavaProjects/weatherProject/userService/*.jar /opt/userService/ | |
sudo systemctl start userService | |
# - name: SSH into server and restart anotherService | |
# uses: appleboy/ssh-action@master | |
# with: | |
# host: ${{ secrets.SERVER_HOST }} | |
# username: ${{ secrets.SERVER_USERNAME }} | |
# key: ${{ secrets.SERVER_SSH_KEY }} | |
# script: | | |
# sudo systemctl stop anotherService | |
# sudo cp /home/xyl1gan4eg/myJavaProjects/weatherProject/anotherService/*.jar /opt/anotherService/ | |
# sudo systemctl start anotherService |