Skip to content

Commit 5f97f02

Browse files
authored
add: github pages
1 parent c734fc1 commit 5f97f02

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

.github/workflows/main.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Deploy static content to Pages
2+
3+
on:
4+
# 仅在推送到默认分支时运行
5+
push:
6+
branches: ['main']
7+
8+
# 这个选项可以使你手动在 Action tab 页面触发工作流
9+
workflow_dispatch:
10+
11+
# 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
# 允许一个并发部署
18+
concurrency:
19+
group: 'pages'
20+
cancel-in-progress: true
21+
22+
jobs:
23+
# 单次部署的工作描述
24+
deploy:
25+
environment:
26+
name: github-pages
27+
url: ${{ steps.deployment.outputs.page_url }}
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
- name: Set up Node
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: lts/*
36+
cache: 'npm'
37+
- name: Install dependencies
38+
run: npm ci
39+
- name: Build
40+
run: npm run build
41+
- name: Setup Pages
42+
uses: actions/configure-pages@v5
43+
- name: Upload artifact
44+
uses: actions/upload-pages-artifact@v3
45+
with:
46+
# 上传 dist 文件夹
47+
path: './dist'
48+
- name: Deploy to GitHub Pages
49+
id: deployment
50+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)