Skip to content

Commit

Permalink
fix: actions deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
him-bhutani7 committed Jan 16, 2024
1 parent dafd566 commit 429b500
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions .github/workflows/build-deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ name: Build & Deploy PROD

on:
push:
tags:
- 'v*'
workflow_dispatch:
branches:
- fix/actions-deployment

env:
AWS_REGION: ${{ secrets.AWS_REGION }}
Expand All @@ -30,44 +29,45 @@ jobs:
- name: checkout
uses: actions/checkout@v2

- name: Set output
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
# - name: Set output
# id: vars
# run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/github-actions-role
aws-region: ${{ env.AWS_REGION }}
role-session-name: GithubActions

# gather metadata from git & github actions to reference in docker
- name: git & github metadata
id: metadata
uses: docker/metadata-action@v3
with:
images: ${{ env.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/${{ env.AWS_ECR_REPO }}
# - name: git & github metadata
# id: metadata
# uses: docker/metadata-action@v3
# with:
# images: ${{ env.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/${{ env.AWS_ECR_REPO }}

# login in docker repository
- name: docker login
uses: aws-actions/amazon-ecr-login@v1
# # login in docker repository
# - name: docker login
# uses: aws-actions/amazon-ecr-login@v1

# build a docker image
- name: docker & push image
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: |
${{ env.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/${{ env.ECR_REPO }}:latest
${{ env.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/${{ env.ECR_REPO }}:${{ steps.vars.outputs.tag }}
# # build a docker image
# - name: docker & push image
# uses: docker/build-push-action@v2
# with:
# context: .
# file: ./Dockerfile
# push: true
# tags: |
# ${{ env.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/${{ env.ECR_REPO }}:latest
# ${{ env.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/${{ env.ECR_REPO }}:${{ steps.vars.outputs.tag }}

# deploy to AWS ECS
- name: Deploy to Amazon ECS
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: infra/aws-ecs/task_definition_${{ env.ENVIRONMENT }}.json
service: ${{ env.ECS_SERVICE }}
cluster: ${{ env.ECS_CLUSTER }}
wait-for-service-stability: true

# # deploy to AWS ECS
# - name: Deploy to Amazon ECS
# uses: aws-actions/amazon-ecs-deploy-task-definition@v1
# with:
# task-definition: infra/aws-ecs/task_definition_${{ env.ENVIRONMENT }}.json
# service: ${{ env.ECS_SERVICE }}
# cluster: ${{ env.ECS_CLUSTER }}
# wait-for-service-stability: true

0 comments on commit 429b500

Please sign in to comment.