Skip to content

Commit

Permalink
Update build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
imrkgofficial authored Nov 27, 2024
1 parent dada730 commit 71e56e1
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Build to AWS Public ECR
name: Build to AWS ECR

on: push
on: push

jobs:
login-to-aws:
Expand All @@ -9,28 +9,33 @@ jobs:
- name: Code Checkout
uses: actions/checkout@v4

- name: Configure AWS Credentials
- name: Login to AWS
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: ${{ secrets.PUBLIC_REGION }}

build-and-push-public-ecr:
build-and-push-pub-ecr:
runs-on: ubuntu-latest
needs: login-to-aws

needs:
login-to-aws:

steps:
- name: Code Checkout
uses: actions/checkout@v4

- name: Amazon ECR Login Action
uses: aws-actions/amazon-ecr-login@v2
- name: Login to AWSECR
uses: docker/login-action@v3
with:
registry-type: public

- name: Build and Push Image to Public ECR
registry: public.ecr.aws
username: ${{ secrets.ACCESS_KEY }}
password: ${{ secrets.SECRET_ACCESS_KEY }}
env:
aws-region: ${{ secrets.PUBLIC_REGION }}

- name: Build Image
run: |
docker build -t bank .
docker tag bank:latest public.ecr.aws/h8o8x8t1/bank:v1
docker push public.ecr.aws/h8o8x8t1/bank:v1
docker build -t bank .
docker tag bank:latest public.ecr.aws/h8o8x8t1/bank:v5
docker push public.ecr.aws/h8o8x8t1/bank:v5

0 comments on commit 71e56e1

Please sign in to comment.