Skip to content

feat: auto-generate department list from Anteater API #2458

feat: auto-generate department list from Anteater API

feat: auto-generate department list from Anteater API #2458

name: Deploy - Staging
on:
pull_request:
types: [opened, synchronize, reopened]
paths-ignore:
- 'apps/pwa/**'
repository_dispatch:
types: [deploy-command]
concurrency:
group: sst-staging-${{ github.event.pull_request.number || github.event.client_payload.pull_request.number }}
cancel-in-progress: false
env:
AWS_REGION: ${{ secrets.AWS_REGION }}
DB_URL: ${{ secrets.DEV_DB_URL }}
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
NEXT_PUBLIC_TILES_ENDPOINT: ${{ secrets.NEXT_PUBLIC_TILES_ENDPOINT }}
ANTEATER_API_KEY: ${{ secrets.ANTEATER_API_KEY }}
OIDC_CLIENT_ID: ${{ secrets.OIDC_CLIENT_ID }}
OIDC_ISSUER_URL: ${{ secrets.OIDC_ISSUER_URL }}
GOOGLE_REDIRECT_URI: ${{ secrets.GOOGLE_REDIRECT_URI }}
NEXT_PUBLIC_PUBLIC_POSTHOG_KEY: ${{ secrets.NEXT_PUBLIC_PUBLIC_POSTHOG_KEY }}
PLANNER_CLIENT_API_KEY: ${{ secrets.PLANNER_CLIENT_API_KEY }}
jobs:
deploy-staging:
runs-on: ubuntu-latest
environment:
name: staging-${{ github.event.pull_request.number || github.event.client_payload.pull_request.number }}
url: https://scheduler-${{ github.event.pull_request.number || github.event.client_payload.pull_request.number }}.antalmanac.com
env:
SST_STAGE: staging-${{ github.event.pull_request.number || github.event.client_payload.pull_request.number }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.event.client_payload.pull_request.head.sha }}
- name: Create deployment
id: create-deployment
uses: chrnorm/deployment-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
environment: staging-${{ github.event.pull_request.number || github.event.client_payload.pull_request.number }}
ref: ${{ github.event.pull_request.head.sha || github.event.client_payload.pull_request.head.sha }}
description: Staging deployment for PR #${{ github.event.pull_request.number || github.event.client_payload.pull_request.number }}
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Setup Node.js and pnpm
uses: ./.github/actions/setup-node-and-pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Migrate database
env:
DB_URL: ${{ secrets.DEV_DB_URL }}
run: pnpm db:migrate
- name: Generate termData
uses: ./.github/actions/cache-generated-data
with:
api-key: ${{ secrets.ANTEATER_API_KEY }}
- name: Deploy SST (staging)
id: deploy
run: |
echo "Deploying stage: $SST_STAGE"
npx sst deploy --stage "$SST_STAGE"
- name: Update deployment status (success)
if: success()
uses: chrnorm/deployment-status@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
deployment-id: ${{ steps.create-deployment.outputs.deployment_id }}
state: success
environment-url: https://scheduler-${{ github.event.pull_request.number || github.event.client_payload.pull_request.number }}.antalmanac.com
- name: Add reaction to comment
if: github.event_name == 'repository_dispatch'
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
reactions: rocket
- name: Update deployment status (failure)
if: failure()
uses: chrnorm/deployment-status@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
deployment-id: ${{ steps.create-deployment.outputs.deployment_id }}
state: failure