Skip to content

Commit ac3b76f

Browse files
committed
build: ec2에 배포 과정 추가
1 parent 565cbdd commit ac3b76f

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

.github/workflows/deploy.yml

+21-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
66
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
77

8-
name: build
8+
name: deploy
99

1010
on:
1111
push:
@@ -19,18 +19,37 @@ jobs:
1919
- name: Setup MySQL
2020
run: |
2121
sudo docker run -d -p 20000:3306 -e MYSQL_DATABASE=busan -e MYSQL_ROOT_PASSWORD=password mysql:8.0.23
22+
2223
- uses: actions/checkout@v3
2324
- uses: actions/setup-java@v3
2425
with:
2526
java-version: '17'
2627
distribution: 'temurin'
28+
2729
- name: Build with Gradle
2830
uses: gradle/[email protected]
2931
with:
3032
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+
uses: appleboy/[email protected]
45+
with:
46+
host: ${{ secrets.HOST }}
47+
username: 'ubuntu'
48+
key: ${{ secrets.PRIVATE_KEY }}
49+
script: /home/ubuntu/server/deploy.sh
50+
3151
- name: Docker build and push
3252
run: |
3353
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
3454
docker build -t ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }} .
3555
docker push ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }}
36-

0 commit comments

Comments
 (0)