From f1f9220091bced9c9e3a5f5184f06282291ae46c Mon Sep 17 00:00:00 2001 From: Umesh Bhujel Date: Sat, 1 Apr 2023 01:30:13 +0545 Subject: [PATCH 01/12] Added deployment for testing --- .github/workflows/deployment.yml | 46 ++++++++++++++++++++++++++++++++ .gitignore | 1 + 2 files changed, 47 insertions(+) create mode 100644 .github/workflows/deployment.yml diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml new file mode 100644 index 0000000..ad2a06f --- /dev/null +++ b/.github/workflows/deployment.yml @@ -0,0 +1,46 @@ +name: Deployment +on: + push: + branches: [ main ] +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python Environment + uses: actions/setup-python@v3 + with: + python-version: '3.x' + architecture: 'x64' + - name: Install Dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + - name: Run Tests + run: | + python manage.py test + deploy: + needs: build + name: Deploy + runs-on: ubuntu-latest + steps: + - name: Checkout Github Source Code + uses: actions/checkout@v3 + - name: Generate deployment package + run: zip -r deploy.zip . -x '*.git*' + - name: Create Version Label + run: | + echo "VERSION_LABEL=$(date +'%Y-%m-%d:%H:%M:%S')" >> $GITHUB_ENV + # Deploy zipped archive to AWS + - name: Deploy to EB + uses: einaregilsson/beanstalk-deploy@v21 + with: + aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + use_existing_version_if_available: true + application_name: ${{ secrets.AWS_APPLICATION_NAME }} + environment_name: ${{ secrets.AWS_APPLICATION_ENVIRONMENT }} + version_label: ${{ env.VERSION_LABEL }} + region: us-east-1 + deployment_package: deploy.zip \ No newline at end of file diff --git a/.gitignore b/.gitignore index 048c4d6..004dba2 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /deb_dist/ /dist/ /helloworld.egg-info/ +.idea/ From f2b74a726606621fa3b9d6e5c53dabbfa29ecefb Mon Sep 17 00:00:00 2001 From: Umesh Bhujel Date: Sat, 1 Apr 2023 01:31:58 +0545 Subject: [PATCH 02/12] changed the main branch to master| --- .github/workflows/deployment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index ad2a06f..3f157b5 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -1,7 +1,7 @@ name: Deployment on: push: - branches: [ main ] + branches: [ master ] jobs: build: name: Build From ff9d29dc68b547157de5632a06683e163f2704d4 Mon Sep 17 00:00:00 2001 From: Umesh Bhujel Date: Sat, 1 Apr 2023 01:32:55 +0545 Subject: [PATCH 03/12] update --- .github/workflows/deployment.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 3f157b5..54e85d5 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -12,7 +12,6 @@ jobs: uses: actions/setup-python@v3 with: python-version: '3.x' - architecture: 'x64' - name: Install Dependencies run: | python -m pip install --upgrade pip From 6244f623147aa04b79bd29439f36916c205c9fc1 Mon Sep 17 00:00:00 2001 From: Umesh Bhujel Date: Sat, 1 Apr 2023 01:35:48 +0545 Subject: [PATCH 04/12] Update --- .github/workflows/deployment.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 54e85d5..7f10088 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -15,10 +15,6 @@ jobs: - name: Install Dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt - - name: Run Tests - run: | - python manage.py test deploy: needs: build name: Deploy From 990d72a9f9d87d12f1207200bd13c0f27f423c22 Mon Sep 17 00:00:00 2001 From: Umesh Bhujel Date: Sat, 1 Apr 2023 01:52:42 +0545 Subject: [PATCH 05/12] Update --- .github/workflows/deployment.yml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 7f10088..026372e 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -3,20 +3,7 @@ on: push: branches: [ master ] jobs: - build: - name: Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up Python Environment - uses: actions/setup-python@v3 - with: - python-version: '3.x' - - name: Install Dependencies - run: | - python -m pip install --upgrade pip deploy: - needs: build name: Deploy runs-on: ubuntu-latest steps: From 88a1bbf82c0f13834d485ddf1bd378d4c549ae04 Mon Sep 17 00:00:00 2001 From: Umesh Bhujel Date: Sat, 1 Apr 2023 02:09:35 +0545 Subject: [PATCH 06/12] Update --- .github/workflows/deployment.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 026372e..79e27a5 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -3,7 +3,25 @@ on: push: branches: [ master ] jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Set up Python Environment + uses: actions/setup-python@v2 + with: + python-version: '3.x' + - name: Install Dependencies + run: | + python -m pip install --upgrade pip + # pip install -r requirements.txt + + - name: Run Tests + run: | + python manage.py test deploy: + needs: build name: Deploy runs-on: ubuntu-latest steps: From 0c1c261b935ac2dfef3da41d78c58a77772dad13 Mon Sep 17 00:00:00 2001 From: Umesh Bhujel Date: Sat, 1 Apr 2023 02:11:04 +0545 Subject: [PATCH 07/12] Update --- .github/workflows/deployment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 79e27a5..c854ed7 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -19,7 +19,7 @@ jobs: - name: Run Tests run: | - python manage.py test + python setup.py test deploy: needs: build name: Deploy From dd80e1f0eedfa712c873201645eab08a04283c97 Mon Sep 17 00:00:00 2001 From: Umesh Bhujel Date: Sat, 1 Apr 2023 03:04:22 +0545 Subject: [PATCH 08/12] Update --- .github/workflows/deployment.yml | 47 ++++++++++++-------------------- 1 file changed, 17 insertions(+), 30 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index c854ed7..3c26dd8 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -3,44 +3,31 @@ on: push: branches: [ master ] jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Set up Python Environment - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - name: Install Dependencies - run: | - python -m pip install --upgrade pip - # pip install -r requirements.txt - - - name: Run Tests - run: | - python setup.py test deploy: - needs: build name: Deploy runs-on: ubuntu-latest steps: - name: Checkout Github Source Code uses: actions/checkout@v3 - - name: Generate deployment package - run: zip -r deploy.zip . -x '*.git*' - - name: Create Version Label + + - name: Set Up Python 3.8 + uses: actions/setup-python@v4 + with: + python-version: "3.8" + - name: Get EB CLI version run: | - echo "VERSION_LABEL=$(date +'%Y-%m-%d:%H:%M:%S')" >> $GITHUB_ENV - # Deploy zipped archive to AWS - - name: Deploy to EB - uses: einaregilsson/beanstalk-deploy@v21 + python -m pip install --upgrade pip + pip install awsebcli --upgrade + eb --version + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 with: aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - use_existing_version_if_available: true - application_name: ${{ secrets.AWS_APPLICATION_NAME }} - environment_name: ${{ secrets.AWS_APPLICATION_ENVIRONMENT }} - version_label: ${{ env.VERSION_LABEL }} region: us-east-1 - deployment_package: deploy.zip \ No newline at end of file + - name: Create EBS application + run: | + eb init -p python-3.8 hello-world --region us-east-1 + - name: Create test environment & deploy + run: | + (eb use ${{ secrets.AWS_APPLICATION_ENVIRONMENT }} && eb status ${{ secrets.AWS_APPLICATION_ENVIRONMENT }} && eb deploy) || eb create ${{ secrets.AWS_APPLICATION_ENVIRONMENT }} \ No newline at end of file From 89099dc5c3f8c10691159b785323cf9261114cba Mon Sep 17 00:00:00 2001 From: Umesh Bhujel Date: Sat, 1 Apr 2023 03:07:51 +0545 Subject: [PATCH 09/12] Update --- .github/workflows/deployment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 3c26dd8..2e27f5c 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -24,7 +24,7 @@ jobs: with: aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - region: us-east-1 + aws-region: us-east-1 - name: Create EBS application run: | eb init -p python-3.8 hello-world --region us-east-1 From 9ab1540e3ac8d54845c0a6289baab04bfe1edf90 Mon Sep 17 00:00:00 2001 From: Umesh Bhujel Date: Sat, 1 Apr 2023 03:09:45 +0545 Subject: [PATCH 10/12] Update --- .github/workflows/deployment.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 2e27f5c..a9aa015 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -22,8 +22,8 @@ jobs: - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v2 with: - aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws_access_key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: us-east-1 - name: Create EBS application run: | From bca7901cacec6f6b4746897695860d53c0fd75f0 Mon Sep 17 00:00:00 2001 From: Umesh Bhujel Date: Sat, 1 Apr 2023 03:11:24 +0545 Subject: [PATCH 11/12] Update --- .github/workflows/deployment.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index a9aa015..4ad7022 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -22,8 +22,8 @@ jobs: - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v2 with: - aws_access_key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: us-east-1 - name: Create EBS application run: | From 22eced07c661149dad6879bf42e9cc2439049a83 Mon Sep 17 00:00:00 2001 From: Umesh Bhujel Date: Sat, 1 Apr 2023 03:16:35 +0545 Subject: [PATCH 12/12] Update --- .github/workflows/deployment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 4ad7022..0ffb94f 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -27,7 +27,7 @@ jobs: aws-region: us-east-1 - name: Create EBS application run: | - eb init -p python-3.8 hello-world --region us-east-1 + eb init -p python-3.8 ${{ secrets.AWS_APPLICATION_NAME }} --region us-east-1 - name: Create test environment & deploy run: | (eb use ${{ secrets.AWS_APPLICATION_ENVIRONMENT }} && eb status ${{ secrets.AWS_APPLICATION_ENVIRONMENT }} && eb deploy) || eb create ${{ secrets.AWS_APPLICATION_ENVIRONMENT }} \ No newline at end of file