Skip to content

Commit

Permalink
git workflow add deploy to ecr
Browse files Browse the repository at this point in the history
  • Loading branch information
linxiaoxin committed Sep 29, 2024
1 parent ca65029 commit 74a62aa
Showing 1 changed file with 30 additions and 30 deletions.
60 changes: 30 additions & 30 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,36 +54,36 @@ jobs:
- name: Run unit tests
run: ./gradlew test

# build_and_push_image:
# needs: code_scan
# name: Push Docker Image to ECR
# runs-on: ubuntu-latest
#
# steps:
# - name: Checkout
# uses: actions/checkout@v4
#
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v4
# with:
# aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
# aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
# aws-region: ${{ env.AWS_REGION }}
#
# - name: Login to Amazon ECR
# id: login-ecr
# uses: aws-actions/amazon-ecr-login@v2
#
# - name: Build and Push Image
# uses: docker/build-push-action@v6
# with:
# context: .
# file: ./Dockerfile
# push: true
# tags: |
# ${{ env.IMAGE_NAME }}
# ${{ env.LATEST_IMAGE_NAME }}
#
build_and_push_image:
needs: code_scan
name: Push Docker Image to ECR
runs-on: ubuntu-latest

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

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

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

- name: Build and Push Image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: |
${{ env.IMAGE_NAME }}
${{ env.LATEST_IMAGE_NAME }}
# deploy_to_ecs:
# name: Deploy to ECS
# needs: build_and_push_image
Expand Down

0 comments on commit 74a62aa

Please sign in to comment.