参考这篇文章部署了 Hugo ,https://www.fournoas.com/posts/deploy-hugo-site-using-github-actions/
单独 Public 上传之后,https://reid00.github.io/ 可以正常访问,
但是 用 Github Action 之后发现个人主页变成了 index.xml 的形式
查看直接和 public 里面比,少了很多东西
各位彦祖,有知道怎么回事的吗?
name: Deploy Hugo Site to Github Pages on Main Branch
on:
  push:
    branches:
      - main
jobs:
  build-deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository code
        uses: actions/checkout@v3
        
      - name: Setup Hugo
        uses: peaceiris/actions-hugo@v2
        with:
          hugo-version: latest  # 这里的版本号要与你安装的版本号一致
          extended: true
      - name: Build
        run: hugo --minify
      - name: Deploy
        uses: peaceiris/actions-gh-pages@v3
        with:
          deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} # 这里的 ACTIONS_DEPLOY_KEY 则是上面设置 Private Key 的变量名
          external_repository: Reid00/Reid00.github.io # Pages 远程仓库 
          publish_dir: "./public"
          keep_files: false # remove existing files
          publish_branch: main  # deploying branch
          commit_message: ${{ github.event.head_commit.message }}
|  |      1hwdef      2022-06-06 16:33:27 +08:00 跟你执行的时候加了 --minify 参数有关吗 | 
|      2istevenshen      2022-06-06 16:36:50 +08:00 你指定 hugo 版本看看,如 hugo-version: '0.59.0',我也用的是 peaceiris/actions-gh-pages@v3 ,貌似一直都没什么问题 | 
|      3Reid OP @hwdef 应该没关系,我刚刚更新了下试了下,不行,index.html 好多东西没有部署到 github pages 那个仓库 | 
|      4istevenshen      2022-06-06 16:38:09 +08:00 peaceiris/actions-hugo@v2 | 
|      5istevenshen      2022-06-06 16:43:25 +08:00 还有一个就是如果你使用了 themes ,记得要获取 submodule 主题,有时候 theme 目录空了也会导致个人主页变成了 index.xml | 
|      6Reid OP @istevenshen 也不太行,我之前试过,刚刚又更新了下 试了下。这个问题 搞了两天了... | 
|      7Reid OP @istevenshen public 了 source 仓库 https://github.com/Reid00/Reid00.github.io.source 你这个方法,我刚刚加上了,我看看怎么解决这个 error | 
|      8istevenshen      2022-06-06 16:54:32 +08:00 调整一下 jobs  ``` jobs: deploy: runs-on: ubuntu-20.04 # 在什么环境运行任务 steps: - uses: actions/[email protected] # 引用 actions/checkout 这个 action ,与所在的 github 仓库同名 with: submodules: true # Fetch Hugo themes (true OR recursive) 获取 submodule 主题 fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod - name: Setup Hugo # 步骤名自取 uses: peaceiris/actions-hugo@v2 # hugo 官方提供的 action ,用于在任务环境中获取 hugo with: hugo-version: '0.59.0' # 获取指定版本的 hugo ``` | 
|      9Reid OP @istevenshen https://github.com/Reid00/Reid00.github.io.source/runs/6752751574?check_suite_focus=true 调整了,但是报错了, ```shell [submodule "themes/PaperMod"] path = themes/PaperMod url = https://github.com/adityatelange/hugo-PaperMod.git ``` gitmodules 里面是这个,不太知道怎么改 | 
|  |      10jaredyam      2022-06-07 09:53:23 +08:00 只能说你跟随的这篇博文有些过时,现在 Github Action 渲染的 public 基本都放在 github.io 仓库的一个独立分支,hugo 官方指引里有教程。 | 
|      11OOLAOO      2022-06-07 10:29:47 +08:00 同问题, 我用 github actions 部署 hexo 博客打不开, 自己部署就能打开 | 
|      12Reid OP @jaredyam 21 年的确实不是最新的了,但是我看 actions-gh-pages 还是提供了这种方式的, 说明还是兼容的吧,就是不清楚目前的错误在哪里 | 
|      13Reid OP @OOLAOO 我知道我这边的问题了,因为 public 里面又**.reid00.io 的.git 文件,删除之后发现好了 | 
|  |      14tabris17      2022-06-12 11:45:47 +08:00 我是原文的作者,这个 action 脚本我现在还在用,没什么问题呀。我的 hugo 版本是 0.55 ,难道是我用的 hugo 版本比较老的关系? |