-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (35 loc) · 1.26 KB
/
cd.yml
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
name: CD
on:
push:
branches:
- main
jobs:
cd:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'zulu'
- name: Set up .jar
run: ./gradlew bootJar
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: ${{ secrets.DOCKER_REPOSITORY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Deploy For EC2 # EC2 ssh 접속
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST }}
port: ${{ secrets.EC2_SSH_PORT }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_SSH_KEY }}
script: |
cd sfe
docker pull ${{ secrets.DOCKER_REPOSITORY }}
docker rm -f sfe-server
docker run -dp ${{ secrets.SPRING_HOST_PORT }}:${{ secrets.SPRING_CONTAINER_PORT }} --name sfe-server --env-file .env ${{ secrets.DOCKER_REPOSITORY }}