Skip to content

Commit 4ccb9d8

Browse files
committed
ci: add GitHub Actions workflows for deployment
- Add deploy.yml for automatic deployment on main push - Add test-deploy.yml for PR build verification - Support manual trigger via workflow_dispatch - Use peaceiris/actions-gh-pages for gh-pages branch deployment
1 parent 1480045 commit 4ccb9d8

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
12+
concurrency:
13+
group: pages-deploy-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
deploy:
18+
name: Build and Deploy
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Setup pnpm
27+
uses: pnpm/action-setup@v4
28+
with:
29+
version: 9
30+
31+
- name: Setup Node.js
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: 20
35+
cache: pnpm
36+
37+
- name: Install dependencies
38+
run: pnpm install --frozen-lockfile
39+
40+
- name: Build website
41+
run: pnpm run build
42+
env:
43+
NODE_OPTIONS: --max-old-space-size=8192
44+
45+
- name: Deploy to GitHub Pages
46+
uses: peaceiris/actions-gh-pages@v4
47+
with:
48+
github_token: ${{ secrets.GITHUB_TOKEN }}
49+
publish_dir: ./build
50+
user_name: github-actions[bot]
51+
user_email: github-actions[bot]@users.noreply.github.com

.github/workflows/test-deploy.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Test Deployment Build
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
concurrency:
9+
group: test-deploy-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
test-deploy:
14+
name: Test Build
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Setup pnpm
23+
uses: pnpm/action-setup@v4
24+
with:
25+
version: 9
26+
27+
- name: Setup Node.js
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: 20
31+
cache: pnpm
32+
33+
- name: Install dependencies
34+
run: pnpm install --frozen-lockfile
35+
36+
- name: Test build
37+
run: pnpm run build
38+
env:
39+
NODE_OPTIONS: --max-old-space-size=8192

0 commit comments

Comments
 (0)