Skip to content

Weekly drop 09 Nov 2024 #304

Weekly drop 09 Nov 2024

Weekly drop 09 Nov 2024 #304

Workflow file for this run

name: Taboo AI Production CI/CD
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
on:
# Runs when a commit is pushed to the main branch
push:
branches:
- main
jobs:
lint_and_test:
name: Run linter and jest unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: v21.6.1
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install dependencies
run: npm ci
- name: Run linter
run: npm run lint
- name: Run Jest unit tests
run: npm test
supabase_deploy:
name: Deploy production supabase
runs-on: ubuntu-latest
env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
SUPABASE_DB_PASSWORD: ${{ secrets.PRODUCTION_DB_PASSWORD }}
SUPABASE_PROJECT_ID: ${{ secrets.PRODUCTION_PROJECT_ID }}
SUPABASE_OAUTH_GOOGLE_CLIENT_ID: ${{ secrets.SUPABASE_OAUTH_GOOGLE_CLIENT_ID }}
SUPABASE_OAUTH_GOOGLE_CLIENT_SECRET: ${{ secrets.SUPABASE_OAUTH_GOOGLE_CLIENT_SECRET }}
steps:
- uses: actions/checkout@v4
- uses: supabase/setup-cli@v1
with:
version: latest
- run: supabase link --project-ref avosfnqiscrmxpqmhswp
- run: supabase db push
supabase_test:
name: Supabase tests
runs-on: ubuntu-latest
needs: [ supabase_deploy ]
env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
SUPABASE_OAUTH_GOOGLE_CLIENT_ID: ${{ secrets.SUPABASE_OAUTH_GOOGLE_CLIENT_ID }}
SUPABASE_OAUTH_GOOGLE_CLIENT_SECRET: ${{ secrets.SUPABASE_OAUTH_GOOGLE_CLIENT_SECRET }}
steps:
- uses: actions/checkout@v4
- uses: supabase/setup-cli@v1
with:
version: latest
- name: Start Supabase local development setup
run: supabase start
- name: Verify generated types are checked in
run: |
supabase gen types typescript --project-id avosfnqiscrmxpqmhswp --schema public > lib/supabase/__generated__/types.ts
if ! git diff --ignore-space-at-eol --exit-code --quiet lib/supabase/__generated__/types.ts; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
vercel_deploy:
name: Deploy production on vercel
runs-on: ubuntu-latest
needs: [ lint_and_test, supabase_test ]
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Install dependencies
run: npm ci
- name: Build Project Artifacts
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} --archive=tgz