Skip to content

Adding region explicitly to fix ECR push #10

Adding region explicitly to fix ECR push

Adding region explicitly to fix ECR push #10

name: Deploy to Amazon ECS
on:
push:
branches:
- main
paths:
- 'apps/prime-generator-python/**'
- '.github/workflows/**'
env:
ECR_REPOSITORY: prime_generator_python
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
environment: dev
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.GH_ACTIONS_IAM_ROLE }}
role-session-name: GHActionsOIDC
aws-region: us-east-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ github.sha }}
with:
aws-region: us-west-2
working-directory: apps/prime-generator-python

Check failure on line 44 in .github/workflows/prime-generator-python.yaml

View workflow run for this annotation

GitHub Actions / Deploy to Amazon ECS

Invalid workflow file

The workflow is not valid. .github/workflows/prime-generator-python.yaml (Line: 44, Col: 9): Unexpected value 'working-directory' .github/workflows/prime-generator-python.yaml (Line: 45, Col: 9): Unexpected value 'run'
run: |
docker build -t "$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" .
docker tag "$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" "$ECR_REGISTRY/$ECR_REPOSITORY:latest"
docker push "$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
docker push "$ECR_REGISTRY/$ECR_REPOSITORY:latest"
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:latest >> $GITHUB_OUTPUT