-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用 GitHub Actions 部署 Hugo 博客到 GitHub Pages #90
Comments
Git 删除所有 commits:https://gist.github.com/heiswayi/350e2afda8cece810c0f6116dadbe651 |
使用后,貌似 GitInfo 出了问题,待解决 |
由 https://github.com/actions/checkout 知,需 set 为什么要使用 checkout 呢?在 待验证 |
可以新建一个仓库了,这样就可以将
可以直接使用环境变量,这样还能发布到 Docker Hub 上,使用起来也不会仅限于 GitHub Actions。同时,在 Actions 中,还能用 可以使用 Actions 的 Default environment variables,这样在 workflow 里面可以减少配置项。而对于 Actions 外,则只需添加名字相同的环境变量即可。 对于时区,除了目前的这种方法,
还可以通过
|
往 commit message 中加入 timezone |
GitInfo 出问题的另一个原因:reuixiy/hugo-theme-meme#27 |
复制
.github
文件夹修改
.github/workflows/build.yml
,GIT_REPO
和GIT_BRANCH
生成
id_rsa
和id_rsa.pub
ssh-keygen -t rsa -b 4096 -C "reuixiy@users.noreply.github.com"
id_rsa
的内容复制,添加到源码仓库的 Settings > Secrets > New secret,Name 必须为GIT_DEPLOY_KEY
;id_ras_pub
的内容复制,添加到部署仓库的 Settings > Deploy keys > Add deploy key,Title 随便,可以为GitHub Pages
,务必勾选 Allow write access。往
static
文件夹下添加一个CNAME
文件,里面加上自己的域名,如io-oi.me
https://docs.github.com/en/github/working-with-github-pages/managing-a-custom-domain-for-your-github-pages-site#configuring-an-apex-domain
git add & git commit & git push
前往部署仓库,Settings > Options > GitHub Pages,将 Source 中的 Branch 选择为
GIT_BRANCH
前往域名提供商,修改 DNS 记录,减少第三方 #87 (comment)
返回部署仓库,将 Enforce HTTPS 勾选
其它:可修改 README.md,加上官方提供的 badge:
[![Built on GitHub](https://github.com/reuixiy/io-oi.me/workflows/build/badge.svg)](https://github.com/reuixiy/io-oi.me/actions)
脚注:对于 GitHub Pages,一个是用户的 GitHub Pages,仓库名必须为
<user>.github.io
;一个项目的 GitHub Pages,将会部署到http(s)://<user>.github.io/<repository>
。https://docs.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sitesThe text was updated successfully, but these errors were encountered: