-
Notifications
You must be signed in to change notification settings - Fork 1
116 lines (106 loc) · 3.01 KB
/
deploy.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: CI/CD
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
issues: write
checks: write
pull-requests: write
actions: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- uses: actions/checkout@v3
- name: make application.yml
run: |
# create application.yml
cd ./src/main/resources
# application.yml 파일 생성
touch ./application.yml
# GitHub-Actions 에서 설정한 값을 application.yml 파일에 쓰기
echo "${{ secrets.APPLICATION }}" >> ./application.yml
shell: bash
- name: Build with Gradle
run: |
./gradlew build
- name: Save test result
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
files: '**/build/test-results/test/TEST-*.xml'
token: ${{ secrets.TOKEN_GITHUB }}
- name: Saves check comment when test fails
uses: mikepenz/action-junit-report@v3
if: always()
with:
report_paths: '**/build/test-results/test/TEST-*.xml'
token: ${{ github.token }}
- name: web docker build and push
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t ${{ secrets.DOCKER_REPO }}/uliga_backend .
docker push ${{ secrets.DOCKER_REPO }}/uliga_backend
deploy_was1:
needs: build
runs-on: ubuntu-latest
steps:
- name: was1 무중단 배포
uses: appleboy/ssh-action@v0.1.7
with:
host: ${{ secrets.WAS1_HOST }}
username: ubuntu
key: ${{ secrets.WAS1_PEM_KEY }}
port: 22
script: |
sudo docker pull ${{ secrets.DOCKER_REPO }}/uliga_backend
bash deploy.sh
deploy_was2:
needs: deploy_was1
runs-on: ubuntu-latest
steps:
- name: was2 무중단 배포
uses: appleboy/ssh-action@v0.1.7
with:
host: ${{ secrets.WAS2_HOST }}
username: ubuntu
key: ${{ secrets.WAS2_PEM_KEY }}
port: 22
script: |
sudo docker pull ${{ secrets.DOCKER_REPO }}/uliga_backend
bash deploy.sh
deploy_web1:
needs: build
runs-on: ubuntu-latest
steps:
- name: was1 nginx 무중단 배포
uses: appleboy/ssh-action@v0.1.7
with:
host: ${{ secrets.WEB_HOST }}
username: ubuntu
key: ${{ secrets.WEB_PEM_KEY }}
port: 22
script: |
bash deploy_was1.sh
deploy_web2:
needs: deploy_web1
runs-on: ubuntu-latest
steps:
- name: was2 nginx 무중단 배포
uses: appleboy/ssh-action@v0.1.7
with:
host: ${{ secrets.WEB_HOST }}
username: ubuntu
key: ${{ secrets.WEB_PEM_KEY }}
port: 22
script: |
bash deploy_was2.sh