Skip to content

Commit 4bf7c37

Browse files
committed
Add Build CI
1 parent 81110e3 commit 4bf7c37

File tree

5 files changed

+57
-3
lines changed

5 files changed

+57
-3
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Deploy Website on Release
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
workflow_dispatch:
8+
9+
jobs:
10+
11+
check-skip-ci:
12+
runs-on: ubuntu-latest
13+
outputs:
14+
should_skip: ${{ steps.check.outputs.should_skip }}
15+
steps:
16+
- id: check
17+
name: Check if [skip ci] is in commit message
18+
run: |
19+
if echo "${{ github.event.head_commit.message || '' }}" | grep -i '\[skip ci\]'; then
20+
echo "should_skip=true" >> $GITHUB_OUTPUT
21+
else
22+
echo "should_skip=false" >> $GITHUB_OUTPUT
23+
fi
24+
25+
build-and-deploy:
26+
runs-on: ubuntu-latest
27+
needs: check-skip-ci
28+
if: needs.check-skip-ci.outputs.should_skip != 'true'
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- name: Setup Node.js
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: '22'
36+
37+
- name: Install dependencies
38+
run: npm ci
39+
40+
- name: Build site
41+
run: cp sample.env .env && npm run build
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
45+
- name: Deploy to Vercel
46+
run: |
47+
npx vercel --prod --token "${{ secrets.VERCEL_TOKEN }}" --yes
48+
env:
49+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
50+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
51+
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
52+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ dist
129129
.yarn/install-state.gz
130130
.pnp.*
131131
/temp
132+
/tmp
132133
.vercel
133134
/public
134135
.DS_Store

.vercelignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@
1313
/views
1414
/res
1515
/.env
16-
sample.env
16+
sample.env
17+
/tmp

api/token.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { listTokens, delToken, reToken, newToken, editTokenName } from '../src/s
44
import { User } from '../src/server/models/user-model'
55

66
function tokenLimitExceeded (user: User): boolean {
7-
return user.tokenIds.split(',').length >= user.tokenLimit
7+
return user.tokenIds.split(',').filter(d => d).length >= user.tokenLimit
88
}
99

1010
export default async function token (req: VercelRequest, res: VercelResponse): Promise<void> {

sample.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#prod
2-
CLIENT_ID_PROD=xxx
2+
CLIENT_ID_PROD=Ov23ctdmdYpfE9MnQ4Qi
33
CLIENT_SECRET_PROD=yyy
44

55
# dev

0 commit comments

Comments
 (0)