返回 ppt-master
deploy-pages.yml
根目录 / .github / workflows / deploy-pages.yml
1 # GitHub Pages 部署工作流
2 # 自动将 PPT Master 示例项目部署到 GitHub Pages
3
4 name: Deploy to GitHub Pages
5
6 on:
7 # 推送到 main 分支时,仅网页相关文件变更才触发
8 push:
9 branches: ["main"]
10 paths:
11 - 'index.html'
12 - 'viewer.html'
13 - 'examples/**'
14 - '.github/workflows/deploy-pages.yml'
15 # 允许手动触发(不受路径限制)
16 workflow_dispatch:
17
18 # 设置 GITHUB_TOKEN 权限
19 permissions:
20 contents: read
21 pages: write
22 id-token: write
23
24 # 防止并发部署
25 concurrency:
26 group: "pages"
27 cancel-in-progress: false
28
29 jobs:
30 # 构建任务
31 build:
32 runs-on: ubuntu-latest
33 steps:
34 - name: Checkout
35 uses: actions/checkout@v4
36
37 - name: Setup Pages
38 uses: actions/configure-pages@v4
39 with:
40 enablement: true
41
42 - name: Upload artifact
43 uses: actions/upload-pages-artifact@v3
44 with:
45 # 上传整个仓库(包含 examples、templates 等)
46 path: '.'
47
48 # 部署任务
49 deploy:
50 environment:
51 name: github-pages
52 url: ${{ steps.deployment.outputs.page_url }}
53 runs-on: ubuntu-latest
54 needs: build
55 steps:
56 - name: Deploy to GitHub Pages
57 id: deployment
58 uses: actions/deploy-pages@v4
59
59 lines YAML