github工作流自动完成hexo部署
github工作流自动完成hexo部署
你应该先确保本地可以正常生成hexo,并且可以正常部署!
1. 在hexo项目\.github\workflows\目录下创建任意名称的.yml文件
2. 将下列yml内容复制到你的文件中,并修改env中的内容为你的配置
官网给出的yml文件,好像并没有考虑到使用主题的情况。我用的fluid主题,在checkout时无法正常签出,导致后续hexo g命令报错no layout。这里给出的解决方案是使用子模块,即git中的submodule。将资源文件全部整合到hexo的source文件目录中,配置文件放在hexo项目根目录中。 不要直接修改主题中的任何文件!!
3. 配置GitHub项目密钥
secrets存放位置
4. 尝试push,并查看GitHub-Action中的日志。如果成功则会显示绿色,如果是红色就要查看日志慢慢排查咯~
源代码
1 | |
env填写方式:
Key Value Information Type Default Required PERSONAL_TOKENDepending on the repository permissions you may need to provide the action with a GitHub Personal Access Token in order to deploy. You can learn more about how to generate one here. This should be stored as a secret. secretsYes PUBLISH_REPOSITORYThe repository the action should deploy to. for example theme-keep/siteenvYes BRANCHThe branch the action should deploy to. for example masterenvgh-pagesYes PUBLISH_DIRThe folder the action should deploy. for example ./publicenv./publicNo CNAMEThe domain name of your GitHub Pages specified in a CNAME envNo
github工作流自动完成hexo部署
http://blog.jiuge.host/post/20230723115242.html