add slides menu #338
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 调试部署工作流 | |
| # | |
| # 当前策略: | |
| # - 任意分支 push 都触发完整构建和部署(便于联调流程) | |
| # - master 分支上的 pull_request 也会触发 | |
| # | |
| # 调试结束后,可将 on.push.branches 收敛为 [master] | |
| # 以恢复仅主分支推送触发部署 | |
| # | |
| name: Deploy to Github Pages | |
| on: | |
| push: | |
| # 调试模式:匹配所有分支 | |
| branches: ['**'] | |
| pull_request: | |
| branches: [master] | |
| workflow_dispatch: | |
| env: | |
| HUGO_VERSION: '0.148.2' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.21' | |
| - name: Cache Hugo binary | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/hugo | |
| key: ${{ runner.os }}-hugo-${{ env.HUGO_VERSION }} | |
| - name: Cache Go modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cache/go-build | |
| ~/go/pkg/mod | |
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}-v2 | |
| restore-keys: | | |
| ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
| ${{ runner.os }}-go- | |
| - name: Cache Hugo resources | |
| uses: actions/cache@v4 | |
| with: | |
| path: resources | |
| key: hugo-resources-${{ hashFiles('assets/**') }} | |
| restore-keys: | | |
| hugo-resources- | |
| - name: Setup Hugo | |
| uses: peaceiris/actions-hugo@v3 | |
| with: | |
| hugo-version: ${{ env.HUGO_VERSION }} | |
| extended: true | |
| - name: Build | |
| env: | |
| HUGO_ENV: production | |
| NODE_ENV: production | |
| HUGO_CACHEDIR: /tmp/hugo_cache | |
| run: | | |
| mkdir -p /tmp/hugo_cache | |
| hugo --minify --gc --enableGitInfo --cleanDestinationDir --logLevel info | |
| - name: Deploy 🚀 | |
| uses: JamesIves/[email protected] | |
| with: | |
| branch: gh-pages | |
| folder: public | |
| clean: false # 保留 gh-pages 历史文件,减少全量删除/重建 | |
| single-commit: false # 保留 gh-pages 提交历史,便于回溯 | |
| force: false # 使用非强推,避免覆盖远端并发更新 | |
| git-config-name: 'github-actions[bot]' | |
| git-config-email: 'github-actions[bot]@users.noreply.github.com' | |
| commit-message: | | |
| Deploy from ${{ github.ref_name }} branch | |
| Source commit: ${{ github.sha }} | |
| Workflow: ${{ github.workflow }} | |
| - name: Debug Info | |
| run: | | |
| echo "🔍 调试信息:" | |
| echo "分支: ${{ github.ref_name }}" | |
| echo "提交: ${{ github.sha }}" | |
| echo "事件: ${{ github.event_name }}" | |
| echo "仓库: ${{ github.repository }}" | |
| echo "运行ID: ${{ github.run_id }}" | |
| echo "" | |
| echo "📝 部署到 GitHub Pages 完成!" | |
| echo "🌐 预览地址: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/" |