From 6f21a61a1fe77f422422a4a364b69b23076b5233 Mon Sep 17 00:00:00 2001 From: shnamm <96981162+shnamm@users.noreply.github.com> Date: Sat, 14 Oct 2023 14:46:35 +0900 Subject: [PATCH 1/5] Create deploy.yml --- .github/workflows/deploy.yml | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..a845f4c --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,45 @@ +name: Django CI/CD + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.10.12 # 사용할 Python 버전 선택 + + - name: Install Dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Run Tests + run: | + python manage.py test + + - name: Deploy to AWS CodeDeploy + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_APPLICATION_NAME: autodeploy + AWS_DEPLOYMENT_GROUP: autoDeployGroup + + run: | + aws deploy create-deployment \ + --application-name $AWS_APPLICATION_NAME \ + --deployment-group-name $AWS_DEPLOYMENT_GROUP \ + --file-exists-behavior OVERWRITE \ + --region ap-northeast-2 From 5d0052ef8b022595b632d140ea9d1b86a572bc0b Mon Sep 17 00:00:00 2001 From: shnamm <96981162+shnamm@users.noreply.github.com> Date: Sat, 14 Oct 2023 15:10:28 +0900 Subject: [PATCH 2/5] Update requirements.txt --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 8b3827f..170ab6f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,3 +19,4 @@ requests-oauthlib==1.3.1 sqlparse==0.4.4 typing_extensions==4.7.1 urllib3==2.0.4 +django-cors-headers From 0329ff1442d48e295418b573339aee60f70fbde6 Mon Sep 17 00:00:00 2001 From: shnamm <96981162+shnamm@users.noreply.github.com> Date: Sat, 14 Oct 2023 15:13:39 +0900 Subject: [PATCH 3/5] Update requirements.txt --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 170ab6f..cd74313 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,3 +20,4 @@ sqlparse==0.4.4 typing_extensions==4.7.1 urllib3==2.0.4 django-cors-headers +mysqlclient From 7695727c710ba5b0f1b68923345caa4348d69359 Mon Sep 17 00:00:00 2001 From: shnamm <96981162+shnamm@users.noreply.github.com> Date: Sat, 14 Oct 2023 15:15:38 +0900 Subject: [PATCH 4/5] Update requirements.txt --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index cd74313..03db8f7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -21,3 +21,4 @@ typing_extensions==4.7.1 urllib3==2.0.4 django-cors-headers mysqlclient +Pillow From dfefc293b1f57c81f0b47c02ebff6d047010a463 Mon Sep 17 00:00:00 2001 From: shnamm <96981162+shnamm@users.noreply.github.com> Date: Sat, 14 Oct 2023 17:50:31 +0900 Subject: [PATCH 5/5] Update deploy.yml --- .github/workflows/deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a845f4c..c15878c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -42,4 +42,5 @@ jobs: --application-name $AWS_APPLICATION_NAME \ --deployment-group-name $AWS_DEPLOYMENT_GROUP \ --file-exists-behavior OVERWRITE \ + --s3-location bucket=mutsa-s3-bucket,bundleType=zip,key=mutsa.zip \ --region ap-northeast-2