-
Notifications
You must be signed in to change notification settings - Fork 3
131 lines (114 loc) · 5.34 KB
/
prod_api_ci_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
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: prod MATCH API Server CI/CD
on:
push:
tags:
- Api-Release-v*.*.*
workflow_dispatch: # 수동 실행 옵션 (생략)
jobs:
build:
runs-on: ubuntu-latest # action 스크립트가 작동될 OS
outputs:
version: ${{ steps.get_version.outputs.BRANCH_NAME }}
steps: # 작업 단계
- name: Checkout source code # 단계별 이름, 구분자로 소스를 가져옴
uses: actions/checkout@v2
- name: Setup JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Set Environment - Common Prod Yml
uses: microsoft/variable-substitution@v1
with:
files: ./Match-Common/src/main/resources/application-common.yml
env:
oauth.kakao.base-url: ${{ secrets.KAKAO_PROD_BASE_URL }}
oauth.kakao.client-id: ${{ secrets.KAKAO_CLIENT }}
oauth.kakao.client-secret: ${{ secrets.KAKAO_SECRET }}
oauth.kakao.redirect-url: ${{ secrets.KAKAO_PROD_REDIRECT }}
oauth.kakao.app-id: ${{ secrets.KAKAO_APP_ID }}
oauth.kakao.admin-key: ${{ secrets.KAKAO_ADMIN_KEY }}
jwt.secret: ${{ secrets.JWT_SECRET_KEY }}
jwt.refresh: ${{ secrets.JWT_REFRESH_KEY }}
oauth.naver.secret: ${{ secrets.NAVER_SECRET }}
oauth.naver.client: ${{ secrets.NAVER_CLIENT }}
oauth.naver.redirect-url: ${{ secrets.NAVER_PROD_REDIRECT}}
sms.secret: ${{ secrets.SMS_SECRET_KEY }}
sms.api: ${{ secrets.SMS_API_KEY }}
sms.sender: ${{ secrets.SMS_SENDER }}
nice.secret: ${{ secrets.NICE_PROD_SECRET_KEY}}
nice.client: ${{ secrets.NICE_PROD_CLIENT_KEY }}
nice.url: ${{ secrets.NICE_PROD_URL}}
aws.access-key: ${{ secrets.AWS_S3_ACCESS_KEY }}
aws.secret-key: ${{ secrets.AWS_S3_SECRET_KEY }}
aws.s3.bucket: ${{ secrets.AWS_S3_BUCKET }}
aws.s3.bucket-url: ${{ secrets.AWS_S3_BASE_URL }}
discord.webhook.error: ${{ secrets.DISCORD_WEBHOOK_ERROR}}
discord.webhook.alert: ${{ secrets.DISCORD_WEBHOOK_ALERT }}
web.return.url: ${{ secrets.PROD_RETURN_URL }}
match.aligo.url: ${ secrets.MATCH_ALIGO_URL }}
server.host: ${{ secrets.PROD_SERVER_HOST}}
spring.password: ${{ secrets.APP_PASSWORD}}
aligo.username: ${{ secrets.ALIGO_USERNAME }}
aligo.key: ${{ secrets.ALIGO_KEY }}
portone.code: ${{ secrets.PORTONE_CODE }}
portone.key: ${{ secrets.PORTONE_KEY }}
portone.secret: ${{ secrets.PORTONE_SECRET }}
portone.billmid: ${{ secrets.PROD_PORTONE_BILL_MID}}
private.aes.key: ${{ secrets.AES_PRIVATE_KEY }}
apple.bundle.id: ${{ secrets.APPLE_BUNDLE_ID }}
apple.team.id: ${{ secrets.APPLE_TEAM_ID }}
aligo.sender-key: ${{ secrets.KAKAO_SENDER_KEY }}
- name: Set Environment Domain - Domain Prod Yml
uses: microsoft/variable-substitution@v1
with:
files: ./Match-Domain/src/main/resources/application-domain-prod.yml
env:
spring.datasource.master.hikari.jdbc-url: ${{ secrets.PROD_DB_URL_HOST }}
spring.datasource.master.hikari.username: ${{ secrets.AWS_DB_USER_NAME }}
spring.datasource.master.hikari.password: ${{ secrets.AWS_DB_PASSWORD }}
spring.datasource.slave.hikari.jdbc-url: ${{ secrets.PROD_SLAVE_URL_HOST }}
spring.datasource.slave.hikari.username: ${{ secrets.AWS_DB_USER_NAME }}
spring.datasource.slave.hikari.password: ${{ secrets.AWS_DB_PASSWORD }}
spring.redis.host : ${{ secrets.REDIS_PROD_HOST }}
- name: create-fcm-json
id: create-fcm-json
uses: jsdaniell/[email protected]
with:
name: "serviceAccountKey.json"
json: ${{ secrets.FCM_JSON }}
dir: "Match-Common/src/main/resources/"
- name: Create Auth Key File
run: |
echo "${{ secrets.AUTH_KEY }}" > ./Match-Common/src/main/resources/AuthKey_74JQ8SGRU2.p8
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
shell: bash
- name: Build with Gradle
run: ./gradlew Match-Api:bootJar
shell: bash
- name: Get current time
uses: 1466587594/get-current-time@v2
id: current-time
with:
format: YYYYMMDDTHHmm
utcOffset: "+09:00"
- name: Generate deployment packagez
run: |
mkdir -p deploy
cp Match-Api/build/libs/*.jar deploy/match-prod-api.jar
cp Procfile deploy/Procfile
cp -r .ebextensions-prod deploy/.ebextensions
cp -r .platform deploy/.platform
cd deploy && zip -r match-prod-api-${{steps.current-time.outputs.formattedTime}}-${{github.sha}} .
- name: Deploy Consumer to EB
uses: einaregilsson/beanstalk-deploy@v19
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
application_name: prodapiserver
environment_name: Prodapiserver-env
version_label: match-prod-api-${{steps.current-time.outputs.formattedTime}}-${{github.sha}}
region: ap-northeast-2
deployment_package: deploy/match-prod-api-${{steps.current-time.outputs.formattedTime}}-${{github.sha}}.zip
wait_for_deployment: false