使用github action发布hugo到github page
2021-06-25, updated 2021-09-12
可以使用github action来进行发布hugo
hugo发布到新的仓库作为github page
在github仓库上选择action,选择set up a workflow yourself
,将下面的内容填入打开的编辑框。
external_repository配置为对应的github page的仓库.
示例代码
|
|
问题一: 将对应的key填入两个github仓库
生成key
1
ssh-keygen -t rsa -C '[email protected]' -f ~/.ssh/action_deploy_key`
会生成两个文件
action_deploy_key.pub
和action_deploy_key
选择external_repository仓库的
Settings-->Deploy keys-->Add deploy key
Title
中填入ACTIONS_DEPLOY_KEY
Key
中填入action_deploy_key.pub
文件内容
选择当前仓库的
Settings-->Secrets-->New repository secret
Name
中填入ACTIONS_DEPLOY_KEY
Value
中填入action_deploy_key
文件内容
问题二: 自定义域名
添加CNAME到hugo的staic目录,内容为custom-domain.com
详细内容查看 https://docs.github.com/cn/actions/learn-github-actions