Skip to content

api: add engine error message mapping #201

api: add engine error message mapping

api: add engine error message mapping #201

Workflow file for this run

name: Deploy API
on:
workflow_dispatch:
push:
paths:
- "apps/api/**"
- "packages/core/**"
branches:
- main
tags:
- api-v*
permissions:
id-token: write
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
environment: ${{ startsWith(github.ref, 'refs/tags/') && 'production' || 'development' }}
steps:
- name: Check out repo
uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ vars.AWS_ROLE_ARN }}
aws-region: ${{ vars.AWS_REGION }}
- name: Log in 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:
IMAGE_TAG: ${{ steps.login-ecr.outputs.registry }}/${{ vars.ECR_REPOSITORY }}:${{ github.sha }}
run: |
docker build -t $IMAGE_TAG -f ./apps/api/Dockerfile .
docker push $IMAGE_TAG
echo "image=$IMAGE_TAG" >> $GITHUB_OUTPUT
- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: ./apps/api/.aws/task-definition-${{ vars.ENVIRONMENT }}.json
container-name: ${{ vars.ENVIRONMENT }}-identity
image: ${{ steps.build-image.outputs.image }}
environment-variables: |
AWS_REGION=${{ vars.AWS_REGION }}
API_ENV_SECRET_NAME=${{ vars.API_ENV_SECRET_NAME }}
DATABASE_SECRET_NAME=${{ vars.DATABASE_SECRET_NAME }}
SENTRY_DSN=${{ vars.SENTRY_DSN }}
SENTRY_ENVIRONMENT=${{ vars.ENVIRONMENT }}
TREASURE_AUTH_KMS_KEY=${{ vars.TREASURE_AUTH_KMS_KEY }}
- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: ${{ vars.ECS_SERVICE }}
cluster: ${{ vars.ECS_CLUSTER }}
wait-for-service-stability: true
release:
needs: deploy
runs-on: ubuntu-latest
environment: ${{ startsWith(github.ref, 'refs/tags/') && 'production' || 'development' }}
steps:
- name: Check out repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Build packages
run: |
npm run build:auth
npm run build:core
- name: Build code
run: npm run build:api
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_ORG: spellcaster
SENTRY_PROJECT: tdk-api
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
with:
environment: ${{ vars.ENVIRONMENT }}
working_directory: ./apps/api
sourcemaps: ./dist
ignore_missing: true