使用github Ation自动化部署hugo
文章目录
创建action
在blog根目录创建:
|
|
内容如下
|
|
配置deploy_key
生成一组ssh-rsa秘钥; 在存储blog的私有仓库中新建名为ACTIONS_DEPLOY_KEY的Action secrets,将私钥复制进去; 在blog发布的github.io仓库中,添加Deploy Keys,将公钥复制进去;
完成
再次提交blog的内容更新,就能看到github action自动运行hugo进行生成并发布到xxx.github.io中了。
Deploy配置说明
⭐️ Deploy to external repository external_repository
By default, your files are published to the repository which is running this action. If you want to publish to another repository on GitHub, set the environment variable external_repository to
For example:
|
|
You can use deploy_key or personal_token. When you use deploy_key, set your private key to the repository which includes this action and set your public key to your external repository.
Note that GITHUB_TOKEN has no permission to access to external repositories. Please create a personal access token and set it to personal_token like personal_token: ${{ secrets.PERSONAL_TOKEN }}.
Use case:
A GitHub Free Plan account cannot use the GitHub Pages in a private repository. To make your source contents private and deploy it with the GitHub Pages, you can deploy your site from a private repository to a public repository using this option.
peaceiris/homepage: A private repository running this action with external_repository: peaceiris/peaceiris.github.io peaceiris/peaceiris.github.io: A public repository using GitHub Pages
文章作者 p3p3pp3
上次更新 2021-05-03