Skip to content

Commit f06bbca

Browse files
committed
ci: 添加GitHub Pages自动部署工作流配置
- 创建.github/workflows/deploy.yml文件 - 配置GitHub Actions在推送到main分支时自动构建script-hook-website - 设置部署到gh-pages分支以发布网站
1 parent 8ad4b39 commit f06bbca

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main # 当推送到main分支时触发
7+
# 允许手动触发工作流
8+
workflow_dispatch:
9+
10+
# 权限设置
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
build-and-deploy:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout 🛎️
19+
uses: actions/checkout@v3
20+
21+
- name: Setup Node.js 🔧
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: '18'
25+
cache: 'npm'
26+
cache-dependency-path: './script-hook-website/package-lock.json'
27+
28+
- name: Install Dependencies 📦
29+
run: |
30+
cd script-hook-website
31+
npm ci
32+
33+
- name: Build 🏗️
34+
run: |
35+
cd script-hook-website
36+
npm run build
37+
38+
- name: Deploy 🚀
39+
uses: JamesIves/github-pages-deploy-action@v4
40+
with:
41+
folder: script-hook-website/dist # 要部署的文件夹
42+
branch: gh-pages # 部署到的分支
43+
clean: true # 在部署前清理目标分支

0 commit comments

Comments
 (0)