Blog

github action deploy hugo blog

December 2, 2021
Blog
Deploy

why # 为了将视线保持在文章上,减少构建和发布的时间占用。 what # github action是GitHub推出的持续集成/持续部署工具,只需要在项目中添加workflow.yml配置文件,在其中配置好任务、工作、步骤等,即可在指定动作发生时自动触发编排好的动作。换言之,如果我们在我们的博客仓库里配置了自动将内容打包和发布的workflow.yml,那我们就可以把精力集中在文章的编写,然后轻轻地提交推送,即可完成博客地打包和发布,very easy and smooth。 how # 在github准备一个blog仓库,用于存放原始信息;再准备一个github page仓库,用于存放打包数据。 其中github page仓库已开启page,可以通过github page设置的域名访问。 我的blog仓库 我的github page仓库 workflow # 这是我结合网络各位英豪所总结出来的一个workflow.yml配置文件 name: blog # 做什么都好,别忘了先起个平凡(kuxuan)的名字 on: # 指定触发动作 push: # 动作是:git push branches: - main # 指定分支: main jobs: build-deploy: runs-on: ubuntu-latest # 基于ubuntu steps: - uses: actions/checkout@v2 # 切换分支:git checkout with: submodules: recursive # Fetch Hugo themes (true OR recursive) fetch-depth: 0 # Fetch all history for . ...