Merge pull request #40 from Almaeng-i/develop #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} | |
MYSQL_ROOT_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 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 | |