Skip to content

chore: fix sam deploy #745

chore: fix sam deploy

chore: fix sam deploy #745

Workflow file for this run

name: Deploy Backend to Preview ECS
# on:
# workflow_run:
# workflows: ["PR Tests"]
# types:
# - completed
on:
pull_request:
branches: [ "main" ]
paths:
- .github/workflows/aws-preview.yml
- server/**
- petercat_utils/**
- subscriber/**
- template.yml
env:
AWS_REGION: ${{ vars.AWS_REGION }}
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
actions: write
jobs:
deploy:
runs-on: ubuntu-latest
environment: Preview
strategy:
fail-fast: true
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::654654285942:role/Github-OIDC
audience: sts.amazonaws.com
aws-region: ${{ env.AWS_REGION }}
# Build inside Docker containers
- run: sam build --use-container --config-file .aws/petercat-preview.toml
# Prevent prompts and failure when the stack is unchanged
- run: |
sam deploy \
--no-confirm-changeset \
--no-fail-on-empty-changeset \
--config-file .aws/petercat-preview.toml \
--parameter-overrides \
ParameterKey=APIUrl,ParameterValue="https://api-pre.petercat.ai" \
ParameterKey=WebUrl,ParameterValue="https://petercat.ai" \
ParameterKey=StaticUrl,ParameterValue="https://static.petercat.ai" \
ParameterKey=PetercatEnv,ParameterValue="preview" \
ParameterKey=GithubSecretName,ParameterValue=${{ secrets.X_GITHUB_SECRET_NAME }} \
ParameterKey=StaticSecretName,ParameterValue=${{ secrets.STATIC_SECRET_NAME }} \
ParameterKey=LLMTokenSecretName,ParameterValue=${{ vars.LLM_TOKEN_SECRET_NAME }} \
ParameterKey=LLMTokenPublicName,ParameterValue=${{ vars.LLM_TOKEN_PUBLIC_NAME }} \
ParameterKey=StaticKeyPairId,ParameterValue=${{ secrets.STATIC_KEYPAIR_ID }} \
ParameterKey=S3TempBucketName,ParameterValue=${{ vars.S3_TEMP_BUCKET_NAME }} \
ParameterKey=GitHubAppID,ParameterValue=${{ secrets.X_GITHUB_APP_ID }} \
ParameterKey=GithubAppsClientId,ParameterValue=${{ secrets.X_GITHUB_APPS_CLIENT_ID }} \
ParameterKey=GithubAppsClientSecret,ParameterValue=${{ secrets.X_GITHUB_APPS_CLIENT_SECRET }} \
ParameterKey=OpenAIAPIKey,ParameterValue=${{ secrets.OPENAI_API_KEY }} \
ParameterKey=OpenAIBaseUrl,ParameterValue=${{ vars.OPENAI_BASE_URL || 'https://api.openai.com/v1' }} \
ParameterKey=GeminiAPIKey,ParameterValue=${{ secrets.GEMINI_API_KEY }} \
ParameterKey=SupabaseServiceKey,ParameterValue=${{ secrets.SUPABASE_SERVICE_KEY }} \
ParameterKey=SupabaseUrl,ParameterValue=${{ secrets.SUPABASE_URL }} \
ParameterKey=TavilyAPIKey,ParameterValue=${{ secrets.TAVILY_API_KEY }} \
ParameterKey=APIIdentifier,ParameterValue=${{ secrets.API_IDENTIFIER }} \
ParameterKey=FastAPISecretKey,ParameterValue=${{ secrets.FASTAPI_SECRET_KEY }} \
ParameterKey=SQSQueueName,ParameterValue=${{ secrets.SQS_QUEUE_NAME }} \
ParameterKey=SQSQueueUrl,ParameterValue=${{ secrets.SQS_QUEUE_URL }} \
ParameterKey=GitHubToken,ParameterValue=${{ secrets.X_GITHUB_TOKEN }} \
ParameterKey=Auth0Domain,ParameterValue=${{ secrets.AUTH0_DOMAIN }} \
ParameterKey=Auth0ClientId,ParameterValue=${{ secrets.AUTH0_CLIENT_ID }} \
ParameterKey=Auth0ClientSecret,ParameterValue=${{ secrets.AUTH0_CLIENT_SECRET }}