Merge pull request #230 from hypercerts-org/fix/ci_types #113
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: roll out supabase migration to staging | |
on: | |
push: | |
branches: | |
- develop | |
env: | |
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }} | |
SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD }} | |
# Retrieve <project-id> from dashboard url: https://app.supabase.com/project/<project-id> | |
PROJECT_ID: ${{ secrets.SUPABASE_PROJECT_ID }} | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: supabase/setup-cli@v1 | |
with: | |
version: 1.223.10 | |
- name: Start Supabase local development setup | |
run: supabase start | |
- name: Verify generated types are checked in | |
run: | | |
supabase gen types typescript --local > src/types/database-generated.types.ts | |
if ! git diff --ignore-space-at-eol --exit-code --quiet ./src/types/database-generated.types.ts; then | |
echo "Detected uncommitted changes after build. See status below:" | |
git diff | |
exit 1 | |
fi | |
deploy-migrations: | |
runs-on: ubuntu-latest | |
environment: staging | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: supabase/setup-cli@v1 | |
- run: supabase link --project-ref $PROJECT_ID | |
- run: supabase db push | |
run-seed-script: | |
needs: deploy-migrations | |
runs-on: ubuntu-latest | |
environment: staging | |
env: | |
SUPABASE_CACHING_DB_URL: ${{ vars.SUPABASE_CACHING_DB_URL }} | |
SUPABASE_CACHING_SERVICE_API_KEY: ${{ secrets.SUPABASE_CACHING_SERVICE_API_KEY }} | |
OVERRIDE_LOCAL_DB_PROTECTION: "true" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 'Install Node' | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
run_install: false | |
- name: Install dependencies | |
run: pnpm install | |
- name: Run seed script | |
run: npx tsx ./seed.ts |