Deploy to GitHub Pages #48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 部署前端页面到 GitHub Pages | |
| # 当 web/data/ 有变更时自动触发 | |
| name: Deploy to GitHub Pages | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'web/**' | |
| # 当 Fetch Trakt Data 工作流完成时自动触发部署 | |
| workflow_run: | |
| workflows: ["Fetch Trakt Data"] | |
| types: | |
| - completed | |
| # 允许手动触发 | |
| workflow_dispatch: | |
| # 设置 GitHub Pages 所需的权限 | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # 防止多个部署任务同时运行 | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| # ① 检出代码 | |
| - name: 检出仓库 | |
| uses: actions/checkout@v4 | |
| # ② 上传 Pages 产物 | |
| - name: 上传 Pages 产物 | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: web/ | |
| # ③ 部署到 GitHub Pages | |
| - name: 部署到 GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |