diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bcbaec9..2c3d31e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,34 +6,33 @@ jobs: login-to-aws: runs-on: ubuntu-latest steps: - - name: Code Checkout - uses: actions/checkout@v4 + - name: Code Checkout + uses: actions/checkout@v4 - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v4 - with: - aws-access-key-id: ${{ secrets.ACCESS_KEY }} - aws-secret-access-key: ${{ secrets.SECRET_ACCESS_KEY }} - aws-region: ap-south-1 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-access-key-id: ${{ secrets.ACCESS_KEY }} + aws-secret-access-key: ${{ secrets.SECRET_ACCESS_KEY }} + aws-region: ap-south-1 build-and-push-ecr: runs-on: ubuntu-latest needs: login-to-aws steps: - - name: Code Checkout - uses: actions/checkout@v4 + - name: Code Checkout + uses: actions/checkout@v4 + - name: Login to AWS ECR + run: | + echo ${{ secrets.PVT_ECR_PASSWORD }} | docker login --username AWS --password-stdin 637423205071.dkr.ecr.ap-south-1.amazonaws.com + env: + AWS_ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS_KEY }} + AWS_DEFAULT_REGION: ap-south-1 - - name: Login to AWS ECR - run: | - echo ${{ secrets.PVT_ECR_PASSWORD }} | docker login --username AWS --password-stdin 637423205071.dkr.ecr.ap-south-1.amazonaws.com - env: - AWS_ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS_KEY }} - AWS_DEFAULT_REGION: ap-south-1 - - - name: Build and Push Image - run: | - docker build -t bank . - docker tag bank:latest 637423205071.dkr.ecr.ap-south-1.amazonaws.com/bank:latest - docker push 637423205071.dkr.ecr.ap-south-1.amazonaws.com/bank:latest + - name: Build and Push Image + run: | + docker build -t bank . + docker tag bank:latest 637423205071.dkr.ecr.ap-south-1.amazonaws.com/bank:latest + docker push 637423205071.dkr.ecr.ap-south-1.amazonaws.com/bank:latest