Skip to content

Stage Deploy

Stage Deploy #2

Workflow file for this run

name: Stage Deploy via SST
on:
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Cache Next.js Build
uses: actions/cache@v4
with:
path: |
.next/
.open-next/
.sst/
key: cache-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]xs') }}
restore-keys: |
cache-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Install pnpm
run: npm install -g pnpm
- name: Install dependencies
run: pnpm install
- name: Install AWS Creds
run: |
mkdir -p ~/.aws
echo "[default]" > ~/.aws/credentials
echo "aws_access_key_id=${{ secrets.AWS_ACCESS_ID }}" >> ~/.aws/credentials
echo "aws_secret_access_key=${{ secrets.AWS_SECRET_ACCESS_KEY }}" >> ~/.aws/credentials
- name: Set SST Config Secret
run: |
npx sst secrets set DATABASE_URL=${{ secrets.DATABASE_URL_STAGING }} --stage staging
npx sst secrets set NEXT_PUBLIC_SITE_URL=${{ secrets.NEXT_PUBLIC_SITE_URL_STAGING }} --stage staging
npx sst secrets set COMMIT_SHA=${{ github.sha }} --stage staging
- name: Run staging DB Migrations
run: |
STAGE=staging npx tsx cli/migrator.ts
- name: Deploy with SST
run: pnpm run deploy:stage
- name: Clean up AWS Profile
run: rm -rf ~/.aws