Skip to content

Push (#59) (#60)

Push (#59) (#60) #2

name: 'Deploy Production Branch'
on:
push:
branches:
- production
env:
SUPABASE_PROJECT_ID: ${{ secrets.SUPABASE_PROJECT_ID }}
jobs:
run-migrations:
runs-on: ubuntu-latest
environment: production
env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD }}
steps:
- uses: actions/checkout@v4
- uses: supabase/setup-cli@v1
with:
version: latest
- run: supabase link --project-ref $SUPABASE_PROJECT_ID
- run: supabase db push
deploy:
runs-on: ubuntu-latest
needs: run-migrations
environment: production
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
steps:
- uses: actions/checkout@v4
- run: npm install --global vercel@canary
- run: vercel pull --yes --environment=production --token=$VERCEL_TOKEN
- run: |
echo "NEXT_PUBLIC_TURNSTILE_SITE_KEY=${{ secrets.TURNSTILE_SITE_KEY }}" >> $GITHUB_ENV
echo "NEXT_PUBLIC_SUPABASE_URL=${{ secrets.SUPABASE_URL }}" >> $GITHUB_ENV
echo "NEXT_PUBLIC_SUPABASE_ANON_KEY=${{ secrets.SUPABASE_ANON_KEY }}" >> $GITHUB_ENV
echo "TURNSTILE_SECRET_KEY=${{ secrets.TURNSTILE_SECRET_KEY }}" >> $GITHUB_ENV
echo "SUPABASE_SERVICE_ROLE_KEY=${{ secrets.SUPABASE_SERVICE_ROLE_KEY }}" >> $GITHUB_ENV
echo "VOTER_REGISTRATION_REPO_ENCRYPTION_KEY=${{ secrets.VOTER_REGISTRATION_REPO_ENCRYPTION_KEY }}" >> $GITHUB_ENV
echo "GOOGLE_MAPS_API_KEY=${{ secrets.GOOGLE_MAPS_API_KEY }}" >> $GITHUB_ENV
echo "CRYPTO_KEY_COOKIES=${{ secrets.CRYPTO_KEY_COOKIES }}" >> $GITHUB_ENV
- run: vercel build --prod --token=$VERCEL_TOKEN
- run: node scripts/create-or-update-vercel-environment-variables.js production
- run: vercel deploy --prebuilt --prod --token=$VERCEL_TOKEN