Skip to content

Commit

Permalink
updated aws credentials action
Browse files Browse the repository at this point in the history
  • Loading branch information
riteshsonawane1372 committed Oct 15, 2024
1 parent a8828d3 commit 868d08a
Showing 1 changed file with 49 additions and 50 deletions.
99 changes: 49 additions & 50 deletions .github/workflows/build-push-ecr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,59 +12,58 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Access key and secret
- name: Build Web image
# if: github.event_name == 'pull_request'
run: |
echo AccessKey `exp length ${{ secrets.ACCESS_KEY_ID }} ` exp length ${{ secrets.SECRET_ACCESS_KEY }}`
env && cat ~/.aws/credentials
- name: Checkout repository
uses: actions/checkout@v3

# - name: Checkout repository
# uses: actions/checkout@v3
#
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3.0.0
#
# - name: Setup AWS Creds
# uses: aws-actions/configure-aws-credentials@v4.0.2
# with:
# aws-access-key-id: ${{ secrets.ACCESS_KEY_ID }}
# aws-secret-access-key: ${{ secrets.SECRET_ACCESS_KEY }}
# aws-region: us-west-2
#
# - name: login ECR
# if: github.event_name != 'pull_request'
# id: ecr-login
# uses: aws-actions/amazon-ecr-login@v1
#
# - name: Build Backend and and push
# if: github.event_name != 'pull_request'
# env:
# ECR_REGISTRY: ${{ steps.ecr-login.outputs.registry }}
# ECR_REPOSITORY: ${{ secrets.BACKEND_ECR_REPOSITORY }}
# run: |
# VERSION_TAG=$(echo "${{ github.ref }}" | cut -d'/' -f 3)
# TAG=$ECR_REGISTRY/$ECR_REPOSITORY:${VERSION_TAG}
# docker build --platform linux/amd64 --push -t ${TAG} -f ${{ env.Dockerfile_Backend }} .
#
# - name: Build Backend image
# if: github.event_name == 'pull_request'
# run: |
# docker build --platform linux/amd64 -f ${{ env.Dockerfile_Backend }} .
#
#
# - name: Build Web and and push
# if: github.event_name != 'pull_request'
# env:
# ECR_REGISTRY: ${{ steps.ecr-login.outputs.registry }}
# ECR_REPOSITORY: ${{ secrets.WEB_ECR_REPOSITORY }}
# run: |
# VERSION_TAG=$(echo "${{ github.ref }}" | cut -d'/' -f 3)
# TAG=$ECR_REGISTRY/$ECR_REPOSITORY:${VERSION_TAG}
# docker build --platform linux/amd64 --push -t ${TAG} -f ${{ env.Dockerfile_Web }} web/
#
# - name: Build Web image
# if: github.event_name == 'pull_request'
# run: |
# docker build --platform linux/amd64 -f ${{ env.Dockerfile_Web }} web/
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.0.0

- name: Setup AWS Creds
uses: aws-actions/configure-aws-credentials@v4.0.2
with:
aws-access-key-id: ${{ secrets.ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.SECRET_ACCESS_KEY }}
aws-region: us-west-2

- name: login ECR
if: github.event_name != 'pull_request'
id: ecr-login
uses: aws-actions/amazon-ecr-login@v1

- name: Build Backend and and push
if: github.event_name != 'pull_request'
env:
ECR_REGISTRY: ${{ steps.ecr-login.outputs.registry }}
ECR_REPOSITORY: ${{ secrets.BACKEND_ECR_REPOSITORY }}
run: |
VERSION_TAG=$(echo "${{ github.ref }}" | cut -d'/' -f 3)
TAG=$ECR_REGISTRY/$ECR_REPOSITORY:${VERSION_TAG}
docker build --platform linux/amd64 --push -t ${TAG} -f ${{ env.Dockerfile_Backend }} .
- name: Build Backend image
if: github.event_name == 'pull_request'
run: |
docker build --platform linux/amd64 -f ${{ env.Dockerfile_Backend }} .
- name: Build Web and and push
if: github.event_name != 'pull_request'
env:
ECR_REGISTRY: ${{ steps.ecr-login.outputs.registry }}
ECR_REPOSITORY: ${{ secrets.WEB_ECR_REPOSITORY }}
run: |
VERSION_TAG=$(echo "${{ github.ref }}" | cut -d'/' -f 3)
TAG=$ECR_REGISTRY/$ECR_REPOSITORY:${VERSION_TAG}
docker build --platform linux/amd64 --push -t ${TAG} -f ${{ env.Dockerfile_Web }} web/
- name: Build Web image
if: github.event_name == 'pull_request'
run: |
docker build --platform linux/amd64 -f ${{ env.Dockerfile_Web }} web/

Expand Down

0 comments on commit 868d08a

Please sign in to comment.