Skip to content

Commit

Permalink
add action for ecr login and image push
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamsinha-sf committed Feb 24, 2022
1 parent 8e2a58b commit bac526f
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,27 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set output
id: release
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.SF_REF_ARCH_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.SF_REF_ARCH_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.SF_REF_ARCH_AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Set output
id: release
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: Build, tag, and push the image to Amazon ECR
id: build-push-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ secrets.SF_REF_ARCH_REPO_NAME }}
IMAGE_TAG: ${{ steps.release.outputs.tag }}
run: |
source dev_build.sh
# Build a docker container and push it to ECR
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
echo "Pushing image to ECR..."
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"

0 comments on commit bac526f

Please sign in to comment.