Skip to content

Commit

Permalink
deploy script updated
Browse files Browse the repository at this point in the history
  • Loading branch information
piyushK52 committed Nov 21, 2023
1 parent f93c0dc commit 101055a
Showing 1 changed file with 49 additions and 49 deletions.
98 changes: 49 additions & 49 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,58 +7,58 @@ on:

jobs:

build:
name: Build Image
runs-on: ubuntu-latest
# build:
# name: Build Image
# runs-on: ubuntu-latest

steps:
# steps:

- name: Check out code
uses: actions/checkout@v2
# - name: Check out code
# uses: actions/checkout@v2

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ECR_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_ECR_SECRET_KEY }}
aws-region: ap-south-1
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.AWS_ECR_ACCESS_KEY }}
# aws-secret-access-key: ${{ secrets.AWS_ECR_SECRET_KEY }}
# aws-region: ap-south-1

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
# - name: Login to Amazon ECR
# id: login-ecr
# uses: aws-actions/amazon-ecr-login@v1

- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: banodoco-frontend
IMAGE_TAG: latest
id: build-image
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
# - name: Build, tag, and push image to Amazon ECR
# env:
# ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
# ECR_REPOSITORY: banodoco-frontend
# IMAGE_TAG: latest
# id: build-image
# run: |
# docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
# docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
# echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT

- name: Fill in the new image ID in the Amazon ECS task definition
env:
ECS_TASK_DEFINITION: .aws/task-definition.json
CONTAINER_NAME: backend-banodoco-frontend
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@c804dfbdd57f713b6c079302a4c01db7017a36fc
with:
task-definition: ${{ env.ECS_TASK_DEFINITION }}
container-name: ${{ env.CONTAINER_NAME }}
image: ${{ steps.build-image.outputs.image }}
# - name: Fill in the new image ID in the Amazon ECS task definition
# env:
# ECS_TASK_DEFINITION: .aws/task-definition.json
# CONTAINER_NAME: backend-banodoco-frontend
# id: task-def
# uses: aws-actions/amazon-ecs-render-task-definition@c804dfbdd57f713b6c079302a4c01db7017a36fc
# with:
# task-definition: ${{ env.ECS_TASK_DEFINITION }}
# container-name: ${{ env.CONTAINER_NAME }}
# image: ${{ steps.build-image.outputs.image }}

- name: Deploy Amazon ECS task definition
env:
ECS_SERVICE: backend-banodoco-frontend-service
ECS_CLUSTER: backend-banodoco-frontend-cluster
uses: aws-actions/amazon-ecs-deploy-task-definition@df9643053eda01f169e64a0e60233aacca83799a
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: ${{ env.ECS_SERVICE }}
cluster: ${{ env.ECS_CLUSTER }}
wait-for-service-stability: true
# - name: Deploy Amazon ECS task definition
# env:
# ECS_SERVICE: backend-banodoco-frontend-service
# ECS_CLUSTER: backend-banodoco-frontend-cluster
# uses: aws-actions/amazon-ecs-deploy-task-definition@df9643053eda01f169e64a0e60233aacca83799a
# with:
# task-definition: ${{ steps.task-def.outputs.task-definition }}
# service: ${{ env.ECS_SERVICE }}
# cluster: ${{ env.ECS_CLUSTER }}
# wait-for-service-stability: true

update-runner:
name: Update Background Runner
Expand All @@ -68,14 +68,14 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2
with:
path: '../banodoco'
path: 'home/ubuntu/banodoco'

- name: Install dependencies
run: |
source ../banodoco/venv/bin/activate
source home/ubuntu/banodoco/venv/bin/activate
pip install -r requirements.txt
- name: Restart runner
run: |
../stop_process.sh
../run_hosted_runner.sh
home/ubuntu/stop_process.sh
home/ubuntu/run_hosted_runner.sh

0 comments on commit 101055a

Please sign in to comment.