I am trying to create a git action that will rebuild a dockerfile, tag, and push to ecr. Below is my yaml
file. I have tried multiple times and been unsuccessful… No steps defined in
stepsand no workflow called in
uses for the following jobs: build
is the error I get. I also seem to only trigger the work if I manually edit instead of pushing the change to main
. Thank you :).
# action name
name: Deploy to ecr
# run action control
on:
# triggers control update to branch .sh files and push to main
push:
branches:
- 'main'
- 'test_branch/id/** ---- this is the branch/sub folder within the branch that will be changed ---
paths:
- '**.sh'
# define workflow job
jobs:
build:
name: Build image and deploy to ecr
# define job runner
runs-on: ubuntu-latest
# workflow steps
steps:
# authenticate to ecr
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
# credentials to use
aws-access-key-id: ${{ secrets.AWS_DEV_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_DEV_SECRET_ACCESS_KEY }}
aws-region: us-east-2
# login to ecr
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
# docker commands
- name: Build, tag, and push docker image to Amazon ECR
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: git-repo
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
docker push -a $ECR_REGISTRY/$ECR_REPOSITORY