Skip to content

fix(ci): supabase prod pipelines (#4188) #252

fix(ci): supabase prod pipelines (#4188)

fix(ci): supabase prod pipelines (#4188) #252

name: Deploy Supabase Migrations to Production
on:
push:
branches:
- main
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_PRODUCTION_DB_PASSWORD }}
SUPABASE_PROJECT_ID: ${{ secrets.SUPABASE_PRODUCTION_PROJECT_ID }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js 20.5
uses: actions/setup-node@v4
with:
node-version: 20.5.x
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Load Yarn cache
uses: actions/cache@v3
id: yarn_cache_id
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn
- name: Node modules cache
uses: actions/cache@v3
id: node_modules_cache_id
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Install Dependencies
if: steps.yarn_cache_id.outputs.cache-hit != 'true' || steps.node_modules_cache_id.outputs.cache-hit != 'true'
run: yarn install --immutable
- uses: supabase/setup-cli@v1
with:
version: latest
- run: yarn workspace @twilio-paste/backend supabase link --project-ref $SUPABASE_PROJECT_ID
- run: yarn workspace @twilio-paste/backend supabase db push