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

使用hugo建立建立个人网站可以参考使用hugo建立静态个人网站 使用github pages来部署个人网站可以参考GithubPages部署免费网站 下面将会介绍如何通过Github Actions来将以上两个操作关联在一起并自动化完成! github建立Repositories 建立一个unixetc/ghsource.git属性为私有(private)的用来放置Hugo源码,然后再建一个unixetc/unixetc.github.io.git属性为公有(public)并设置Github Pages服务。 github设置Deploy keys与Secrets 使用ssh-keygen命令来生成私钥与公钥。 $ ssh-keygen.exe -t rsa -b 4096 -C "[email protected]" #邮箱自定义 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 [email protected] The key's randomart image is: +---[RSA 4096]----+ | .. +o. | | . . o.. | | . + .... . | |o+ o o = .o . | |+EO o = S . . | |o B . % + . | | .o .oB * | | ...++ B | | ... .. o | +----[SHA256]-----+ 在unixetc/unixetc.gihub.io.git的设置中将公钥内容添加至Deploy keys,名称自定义,并勾选allow write access。 ...

十月 25, 2020 · JQX