forked from seanprashad/leetcode-patterns
-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (60 loc) · 1.77 KB
/
Copy pathci.yml
File metadata and controls
76 lines (60 loc) · 1.77 KB
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
name: CI
on:
pull_request:
types: [opened, synchronize, reopened, closed, labeled]
branches: [main]
permissions:
contents: write
pull-requests: write
jobs:
lint:
if: github.event.action != 'closed'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm run lint
test:
if: github.event.action != 'closed'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
- run: npm ci
- run: npx vitest run --coverage
preview:
if: >-
always() &&
contains(github.event.pull_request.labels.*.name, 'preview') &&
(github.event.action == 'closed' || (needs.lint.result == 'success' && needs.test.result == 'success'))
needs: [lint, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- if: github.event.action != 'closed'
uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
- if: github.event.action != 'closed'
run: npm ci
- if: github.event.action != 'closed'
name: Build
env:
NEXT_PUBLIC_BASE_PATH: /leetcode-patterns/pr-preview/pr-${{ github.event.number }}
NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }}
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY }}
run: npx next build
- if: github.event.action != 'closed'
name: Remove service worker from preview
run: rm -f out/sw.js
- uses: rossjrw/pr-preview-action@v1
with:
source-dir: out