docs(geoserver): 补充原始笔记中的 emoji 和在线截图链接,增强教程的视觉效果和实用性 #45
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
| name: Deploy Hugo site to Pages | |
| on: | |
| # 当推送到默认分支时运行 | |
| push: | |
| branches: ["main"] | |
| # 允许从 Actions 标签页手动运行此工作流 | |
| workflow_dispatch: | |
| # 设置 GITHUB_TOKEN 的权限以允许部署到 GitHub Pages | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # 只允许一个并发部署,跳过正在进行的运行和最新排队运行之间的运行 | |
| # 但是,不要取消正在进行的运行,因为我们希望允许这些生产部署完成 | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| # 默认使用 bash | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| # 构建任务 | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 检出代码 | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: 安装 Hugo | |
| uses: peaceiris/actions-hugo@v2 | |
| with: | |
| hugo-version: '0.148.2' | |
| extended: true | |
| - name: 配置 Pages | |
| id: pages | |
| uses: actions/configure-pages@v4 | |
| - name: 缓存 Hugo 模块 | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.cache/hugo | |
| .hugo_build.lock | |
| key: ${{ runner.os }}-hugo-${{ hashFiles('go.mod', 'go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-hugo- | |
| - name: 安装 Hugo 模块 | |
| run: | | |
| # 显示模块信息 | |
| echo "Go 模块:" | |
| cat go.mod | |
| echo "正在安装 Hugo 模块..." | |
| hugo mod get -u | |
| hugo mod tidy | |
| echo "模块安装成功" | |
| - name: 使用 Hugo 构建 | |
| env: | |
| # 为了与 Hugo 模块的最大向后兼容性 | |
| HUGO_ENVIRONMENT: production | |
| HUGO_ENV: production | |
| run: | | |
| # 显示构建信息 | |
| hugo version | |
| echo "正在构建站点..." | |
| hugo \ | |
| --gc \ | |
| --minify \ | |
| --environment production \ | |
| --logLevel info | |
| # 检查构建输出 | |
| echo "构建输出:" | |
| ls -la public/ | |
| echo "检查 index.html 是否存在:" | |
| ls -la public/index.html || echo "未找到 index.html!" | |
| - name: 上传制品 | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./public | |
| # 部署任务 | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: 部署到 GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |