-
Notifications
You must be signed in to change notification settings - Fork 3
60 lines (48 loc) · 1.91 KB
/
django-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
# This is a basic workflow to help you get started with Actions
name: django-CD
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ develop ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
CD:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2 # Use this repository
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.DJANGO_AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.DJANGO_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Make directory for zip
run: mkdir deploy
- name: Copy src folder
run: cp -r ./backend/qualla/ ./deploy/
- name: Copy appspec.yml
run: cp ./scripts/appspec.yml ./deploy/
- name: Copy start.sh
run: cp ./scripts/start.sh ./deploy/
- name: Zip build folder
run: zip -r -qq ./qualla-deploy.zip ./deploy
- name: Copy zip file to AWS S3
run: |
aws s3 cp \
--region ${{ secrets.AWS_REGION }} \
--acl private \
./qualla-deploy.zip s3://${{ secrets.DJANGO_AWS_BUCKET }}/
- name: Create CodeDeploy Deployment
id: deploy
run: |
aws deploy create-deployment \
--application-name qualla-codedeploy \
--deployment-group-name QuallaBackendDeploy \
--deployment-config-name CodeDeployDefault.OneAtATime \
--file-exists-behavior OVERWRITE \
--s3-location bucket=${{ secrets.DJANGO_AWS_BUCKET }},bundleType=zip,key=qualla-deploy.zip \
--region ap-northeast-2