Skip to content

Commit 81539a4

Browse files
committed
添加GitHub Actions自动部署GitHub Pages配置
1 parent 040ad92 commit 81539a4

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: 部署Office网站到GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main # 当推送到main分支时触发
7+
8+
jobs:
9+
build-and-deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: 检出代码
13+
uses: actions/checkout@v3
14+
15+
- name: 设置Node.js环境
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version: 18
19+
cache: 'npm'
20+
cache-dependency-path: 'office-website/package-lock.json'
21+
22+
- name: 安装依赖
23+
run: |
24+
cd office-website
25+
npm ci
26+
27+
- name: 构建项目
28+
run: |
29+
cd office-website
30+
npm run build
31+
32+
- name: 部署到GitHub Pages
33+
uses: peaceiris/actions-gh-pages@v3
34+
with:
35+
github_token: ${{ secrets.GITHUB_TOKEN }}
36+
publish_dir: ./office-website/build
37+
cname: # 如果你有自定义域名,可以在这里设置

office-website/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"homepage": "https://jsrei.github.io/typescript-userscript-template",
23
"scripts": {
34
"start": "react-scripts start",
45
"build": "react-scripts build",

0 commit comments

Comments
 (0)