Skip to content

Commit fcca103

Browse files
committed
ci: add GitHub Actions workflow for tests and Vercel deploy
1 parent 5bb9365 commit fcca103

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

.github/workflows/ci.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: "20"
19+
cache: "npm"
20+
21+
- name: Install dependencies
22+
run: npm ci
23+
24+
- name: Run linter
25+
run: npm run lint
26+
27+
- name: Run tests
28+
run: npm test
29+
30+
deploy:
31+
needs: test
32+
runs-on: ubuntu-latest
33+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
34+
steps:
35+
- uses: actions/checkout@v4
36+
37+
- name: Setup Node.js
38+
uses: actions/setup-node@v4
39+
with:
40+
node-version: "20"
41+
cache: "npm"
42+
43+
- name: Install Vercel CLI
44+
run: npm install -g vercel
45+
46+
- name: Pull Vercel environment
47+
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
48+
49+
- name: Build project
50+
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
51+
52+
- name: Deploy to Vercel
53+
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}

0 commit comments

Comments
 (0)