-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (40 loc) · 1.41 KB
/
maven.yml
File metadata and controls
46 lines (40 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Java CI with Maven
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Generate the package
run: mvn -B package --file pom.xml
- name: Deploy the package to the remote server
uses: garygrossgarten/github-action-scp@release
with:
recursive: true
local: target/algorithm-0.0.1-SNAPSHOT.jar
remote: /home/${{ secrets.SSH_USER }}/deployment/algo-latest.jar
host: ${{ secrets.HOST }}
username: ${{ secrets.SSH_USER }}
privateKey: ${{ secrets.KEY }}
- name: Start Service
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.KEY }}
port: 22
script: |
sudo mv /home/${{ secrets.SSH_USER }}/deployment/algo-latest.jar /var/algo/algo-0.0.1-SNAPSHOT.jar
sudo chmod 755 /var/algo/algo-0.0.1-SNAPSHOT.jar
sudo systemctl restart algo.service