-
Notifications
You must be signed in to change notification settings - Fork 0
153 lines (141 loc) · 5.63 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
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: Almaeng-i-CD
on:
push:
branches:
- "main"
jobs:
deploy:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:latest
env:
MYSQL_DATABASE: ${{ secrets.MYSQL_NAME }}
MYSQL_USER: ${{ secrets.MYSQL_USER }}
MYSQL_PASSWORD: ${{ secrets.MYSQL_PW }}
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 3
ports:
- 3306:3306
env:
SECRET_KEY: ${{ secrets.SECRET_KEY }}
KAKAO_REST_API_KEY: ${{ secrets.KAKAO_REST_API_KEY }}
KAKAO_CALLBACK_URI: ${{ secrets.KAKAO_CALLBACK_URI }}
KAKAO_LOGIN_URI: ${{ secrets.KAKAO_LOGIN_URI }}
KAKAO_SECRET_KEY: ${{ secrets.KAKAO_SECRET_KEY }}
SERVER_BASE_URL: ${{ secrets.SERVER_BASE_URL }}
ACCESS_EXPIRE_TIME: ${{ secrets.ACCESS_EXPIRE_TIME }}
REFRESH_EXPIRE_TIME: ${{ secrets.REFRESH_EXPIRE_TIME }}
ALGORITHM: ${{ secrets.ALGORITHM }}
MYSQL_NAME: ${{ secrets.MYSQL_NAME }}
MYSQL_USER: ${{ secrets.MYSQL_USER }}
MYSQL_PW: ${{ secrets.MYSQL_PW }}
MYSQL_HOST: ${{ secrets.MYSQL_HOST }}
MYSQL_PORT: ${{ secrets.MYSQL_PORT }}
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_STORAGE_BUCKET_NAME: ${{ secrets.AWS_STORAGE_BUCKET_NAME }}
AWS_BUCKET_ROOT_FOLDER_NAME: ${{ secrets.AWS_BUCKET_ROOT_FOLDER_NAME }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_S3_CUSTOM_DOMAIN: ${{ secrets.AWS_S3_CUSTOM_DOMAIN }}
DEFAULT_FILE_STORAGE: ${{ secrets.DEFAULT_FILE_STORAGE }}
MEDIA_URL: ${{ secrets.MEDIA_URL }}
DEFAULT_PROFILE_URL: ${{ secrets.DEFAULT_PROFILE_URL }}
RECEIVE_IMG_ENDPOINT: ${{ secrets.RECEIVE_IMG_ENDPOINT }}
BASE_S3_URL: ${{ secrets.BASE_S3_URL }}
DEBUG: false # 배포시에는 false로 설정
steps:
- name: Connect deploy key
uses: cloudtype-github-actions/connect@v1
with:
token: ${{ secrets.CLOUDTYPE_TOKEN }}
ghtoken: ${{ secrets.GHP_TOKEN }}
- name: Deploy to Cloudtype
uses: cloudtype-github-actions/deploy@v1
with:
token: ${{ secrets.CLOUDTYPE_TOKEN }}
project: ${{ secrets.CLOUDTYPE_PROJECT_NAME }}
stage: main
yaml: >
name: ${{ secrets.CLOUDTYPE_PROJECT_NAME }}
app: [email protected]
options:
ports: 8000
env:
- name: SECRET_KEY
value: ${{ secrets.SECRET_KEY }}
- name: KAKAO_REST_API_KEY
value: ${{ secrets.KAKAO_REST_API_KEY }}
- name: KAKAO_CALLBACK_URI
value: ${{ secrets.KAKAO_CALLBACK_URI }}
- name: KAKAO_LOGIN_URI
value: ${{ secrets.KAKAO_LOGIN_URI }}
- name: KAKAO_SECRET_KEY
value: ${{ secrets.KAKAO_SECRET_KEY }}
- name: SERVER_BASE_URL
value: ${{ secrets.SERVER_BASE_URL }}
- name: ACCESS_EXPIRE_TIME
value: ${{ secrets.ACCESS_EXPIRE_TIME }}
- name: REFRESH_EXPIRE_TIME
value: ${{ secrets.REFRESH_EXPIRE_TIME }}
- name: ALGORITHM
value: ${{ secrets.ALGORITHM }}
- name: MYSQL_NAME
value: ${{ secrets.MYSQL_NAME }}
- name: MYSQL_USER
value: ${{ secrets.MYSQL_USER }}
- name: MYSQL_PW
value: ${{ secrets.MYSQL_PW }}
- name: MYSQL_HOST
value: ${{ secrets.MYSQL_HOST }}
- name: MYSQL_PORT
value: ${{ secrets.MYSQL_PORT }}
- name: AWS_REGION
value: ${{ secrets.AWS_REGION }}
- name: AWS_STORAGE_BUCKET_NAME
value: ${{ secrets.AWS_STORAGE_BUCKET_NAME }}
- name: AWS_BUCKET_ROOT_FOLDER_NAME
value: ${{ secrets.AWS_BUCKET_ROOT_FOLDER_NAME }}
- name: AWS_ACCESS_KEY_ID
value: ${{ secrets.AWS_ACCESS_KEY }}
- name: AWS_SECRET_ACCESS_KEY
value: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: AWS_S3_CUSTOM_DOMAIN
value: ${{ secrets.AWS_S3_CUSTOM_DOMAIN }}
- name: DEFAULT_FILE_STORAGE
value: ${{ secrets.DEFAULT_FILE_STORAGE }}
- name: MEDIA_URL
value: ${{ secrets.MEDIA_URL }}
- name: DEFAULT_PROFILE_URL
value: ${{ secrets.DEFAULT_PROFILE_URL }}
- name: RECEIVE_IMG_ENDPOINT
value: ${{ secrets.RECEIVE_IMG_ENDPOINT }}
- name: BASE_S3_URL
value: ${{ secrets.BASE_S3_URL }}
- name: DEBUG
value: ${{ secrets.DEBUG }}
context:
git:
url: [email protected]:${{ github.repository }}.git
ref: ${{ github.ref }}
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
- name: Install system dependencies (about docker)
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libmysqlclient-dev
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Make migrations
run: |
python manage.py makemigrations
- name: Run migrations
run: |
python manage.py migrate