Skip to content

added second action

added second action #1

name: deploy-on-aws
on:
push:
branches:
- main
jobs:
push_to_ecr:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2 # allow the runner to access the code in the repository
- name: Login to Amazon ECR
id: login-ecr # needed to reference this step later in the workflow
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: 324-devops-refcard-03
IMAGE_TAG: ${{ github.sha }}
run: |
# Build a docker container and push it to ECR
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG