-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (95 loc) · 3.48 KB
/
preview.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Taboo AI Preview CI/CD
on:
# run when a pull request into main is opened or updated
pull_request:
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 v21.6.1
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 preview supabase
runs-on: ubuntu-latest
env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
SUPABASE_DB_PASSWORD: ${{ secrets.STAGING_DB_PASSWORD }}
SUPABASE_PROJECT_ID: ${{ secrets.STAGING_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 qbjkpfyfmnkerzcmmjbk
- 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 qbjkpfyfmnkerzcmmjbk --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 preview 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=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: Install dependencies
run: npm ci
- name: Build Project Artifacts
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} --archive=tgz