File tree 1 file changed +21
-2
lines changed
1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change 5
5
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
6
6
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
7
7
8
- name : build
8
+ name : deploy
9
9
10
10
on :
11
11
push :
@@ -19,18 +19,37 @@ jobs:
19
19
- name : Setup MySQL
20
20
run : |
21
21
sudo docker run -d -p 20000:3306 -e MYSQL_DATABASE=busan -e MYSQL_ROOT_PASSWORD=password mysql:8.0.23
22
+
22
23
- uses : actions/checkout@v3
23
24
- uses : actions/setup-java@v3
24
25
with :
25
26
java-version : ' 17'
26
27
distribution : ' temurin'
28
+
27
29
- name : Build with Gradle
28
30
29
31
with :
30
32
arguments : clean build openapi3
33
+
34
+ - name : SCP to prod server
35
+ uses : appleboy/scp-action@master
36
+ with :
37
+ username : ubuntu
38
+ host : ${{ secrets.HOST }}
39
+ key : ${{ secrets.PRIVATE_KEY }}
40
+ source : " ./build/libs/*-SNAPSHOT.jar"
41
+ target : " /home/ubuntu/server/app.jar"
42
+
43
+ - name : Deploy
44
+
45
+ with :
46
+ host : ${{ secrets.HOST }}
47
+ username : ' ubuntu'
48
+ key : ${{ secrets.PRIVATE_KEY }}
49
+ script : /home/ubuntu/server/deploy.sh
50
+
31
51
- name : Docker build and push
32
52
run : |
33
53
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
34
54
docker build -t ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }} .
35
55
docker push ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }}
36
-
You can’t perform that action at this time.
0 commit comments