Skip to content

Fix output format

Fix output format #11

Workflow file for this run

name: Deploy to Amazon ECS
on:
push:
branches:
- tasking-manager-fastapi
env:
REGISTRY: ghcr.io
AWS_REGION: us-east-1
ECS_CLUSTER: tasking-manager
ECS_SERVICE: backend-fastAPI
CONTAINER_NAME: backend
IMAGE_NAME: hotosm/tasking-manager-backend # was ${{ github.repository }}
jobs:
image-build-and-push:
name: Build Container Images
runs-on: ubuntu-latest
environment: production
permissions:
contents: read
packages: write
outputs:
image_name: ${{ steps.parse-image-meta.image_name }}
steps:
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set container image metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=fastapi
- name: Build and push container image
id: build-push-image
uses: docker/build-push-action@v5
with:
context: "{{defaultContext}}"
target: prod
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Parse build step metadata
id: parse-image-meta
run: |

Check failure on line 61 in .github/workflows/ecs-deploy.yml

View workflow run for this annotation

GitHub Actions / Deploy to Amazon ECS

Invalid workflow file

The workflow is not valid. .github/workflows/ecs-deploy.yml (Line: 61, Col: 14): Unexpected symbol: '"image'. Located at position 43 within expression: steps.build-push-image.outputs.Metadata.*."image.name"
meta=${{ steps.build-push-image.outputs.Metadata }}
i_name=${{ steps.build-push-image.outputs.Metadata.*."image.name" }}
i_name2=${{ steps.meta.outputs.tags[0] }}
echo image=$( echo $meta | jq '."image.name"' )
echo "image_name=${image}" >> $GITHUB_OUTPUT
deploy:
name: Deploy to ECS
runs-on: ubuntu-latest
environment: production
needs: image-build-and-push
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-1
role-to-assume: arn:aws:iam::670261699094:role/Github-AWS-OIDC
role-session-name: gh-ci-ecs-deploy
- name: Download task definition
run: |
aws ecs describe-task-definition --task-definition tasking-manager-fastAPI --query taskDefinition > task-definition.json
- name: Task definition rendition
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: task-definition.json
container-name: ${{ env.CONTAINER_NAME }}
image: ${{ needs.build-push-image.outputs.image_name }}
# image: ${{ env.IMAGE_NAME }}:fastapi
- name: Deploy task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: ${{ env.ECS_SERVICE }}
cluster: ${{ env.ECS_CLUSTER }}
wait-for-service-stability: true