-
Notifications
You must be signed in to change notification settings - Fork 1
136 lines (117 loc) · 4.37 KB
/
deploy-prod.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
132
133
134
135
136
name: prod-deploy
on:
push:
branches:
- main
workflow_dispatch: # 수동 실행
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- name: Set Profiles Active
uses: christian-draeger/[email protected]
with:
path: './src/main/resources/application.properties'
property: 'spring.profiles.active'
value: prod
- name: Set jwt secret
uses: christian-draeger/[email protected]
with:
path: './src/main/resources/application-prod.properties'
property: 'jwt.secret'
value: ${{ secrets.JWT_SECRET }}
- name: Set mysql url
uses: christian-draeger/[email protected]
with:
path: './src/main/resources/application-prod.properties'
property: 'spring.datasource.url'
value: ${{ secrets.RDS_PRODUCTION_URL }}
- name: Set mysql username
uses: christian-draeger/[email protected]
with:
path: './src/main/resources/application-prod.properties'
property: 'spring.datasource.username'
value: ${{ secrets.RDS_USERNAME }}
- name: Set mysql password
uses: christian-draeger/[email protected]
with:
path: './src/main/resources/application-prod.properties'
property: 'spring.datasource.password'
value: ${{ secrets.RDS_PASSWORD }}
- name: Set daangn app id
uses: christian-draeger/[email protected]
with:
path: './src/main/resources/application-prod.properties'
property: 'karrot.app.id'
value: ${{ secrets.DAANGN_PRODUCTION_APP_ID }}
- name: Set daangn app secret
uses: christian-draeger/[email protected]
with:
path: './src/main/resources/application-prod.properties'
property: 'karrot.app.secret'
value: ${{ secrets.DAANGN_PRODUCTION_APP_SECRET }}
- name: Set daangn api key
uses: christian-draeger/[email protected]
with:
path: './src/main/resources/application-prod.properties'
property: 'karrot.app.apikey'
value: ${{ secrets.DAANGN_PRODUCTION_API_KEY }}
- name: Set Sentry DSN
uses: christian-draeger/[email protected]
with:
path: './src/main/resources/application-prod.properties'
property: 'sentry.dsn'
value: ${{ secrets.SENTRY_PRODUCTION_DSN }}
# - name: Set Mongo
# uses: christian-draeger/[email protected]
# with:
# path: './src/main/resources/application-prod.properties'
# property: 'spring.data.mongodb.uri'
# value: ${{ secrets.SPRING_DATA_MONGODB_URI_PROD }}
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
shell: bash
- name: Build with Gradle
run: ./gradlew clean build
shell: bash
- name: Gradle 빌드 캐싱
id: gradle-cache
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Get current time
uses: 1466587594/get-current-time@v2
id: current-time
with:
format: YYYY-MM-DDTHH-mm-ss
utcOffset: "+09:00"
- name: Generate deployment package # (1)
run: |
mkdir -p deploy
cp build/libs/*.jar deploy/
cp Procfile deploy/Procfile
cp -r .ebextensions deploy/.ebextensions
cp -r .platform deploy/.platform
cd deploy && zip -r deploy.zip .
- name: Deploy to EB # (2)
uses: einaregilsson/beanstalk-deploy@v14
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
application_name: Daangn-survey-prod
environment_name: Daangn-survey-prod-env
version_label: github-action-${{steps.current-time.outputs.formattedTime}}
region: ap-northeast-2
deployment_package: deploy/deploy.zip
wait_for_environment_recovery: false