Github Actions自动生成Hugo站点并部署到Github Pages

使用hugo建立建立个人网站可以参考Hugo安装使用实例 使用github pages来部署个人网站可以参考GithubPages部署免费网站 下面将会介绍如何通过Github Actions来将以上两个操作关联在一起并自动化完成! 建立Repositories 建立一个unixetc/ghsource.git属性为私有(private)的用来放置Hugo源码,然后再建一个unixetc/unixetc.gihub.io.git属性为公有(public)并设置Github Pages服务。 设置Deploy keys与Secrets 使用ssh-keygen命令来生成私钥与公钥。 $ ssh-keygen.exe -t rsa -b 4096 -C "alairs@live.cn" #邮箱自定义 Generating public/private rsa key pair. Enter file in which to save the key (/c/Users/alair/.ssh/id_rsa): #存放目录,可自定义 Created directory '/c/Users/alair/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /c/Users/alair/.ssh/id_rsa #私钥 Your public key has been saved in /c/Users/alair/.ssh/id_rsa.pub #公钥 The key fingerprint is: SHA256:ZiNPDGtAKC6MA alairs@live.

Read More