first init
This commit is contained in:
commit
f75ad8bedd
62
README.md
Normal file
62
README.md
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
# 个人博客
|
||||||
|
|
||||||
|
## 介绍
|
||||||
|
- 该博客由 [hugo](https://www.gohugo.org/) 生成
|
||||||
|
- 使用 [even](https://github.com/olOwOlo/hugo-theme-even/blob/master/README-zh.md) 主题
|
||||||
|
|
||||||
|
## 编辑
|
||||||
|
- 获取博客 md 文件
|
||||||
|
```bash
|
||||||
|
git clone https://git.colben.cn/colben/www.colben.cn.git
|
||||||
|
```
|
||||||
|
|
||||||
|
- 获取主题
|
||||||
|
```bash
|
||||||
|
cd www.colben.cn
|
||||||
|
git clone https://github.com/olOwOlo/hugo-theme-even.git themes/even
|
||||||
|
```
|
||||||
|
|
||||||
|
- 本地编译,生成页面
|
||||||
|
```bash
|
||||||
|
hugo --baseURL="https://www.colben.cn/"
|
||||||
|
```
|
||||||
|
|
||||||
|
- 提交和推送
|
||||||
|
```bash
|
||||||
|
git commit -a -m 'update info'
|
||||||
|
git push
|
||||||
|
```
|
||||||
|
|
||||||
|
## 发布
|
||||||
|
- 进入 gitea 容器,安装 hugo
|
||||||
|
```bash
|
||||||
|
apk update
|
||||||
|
apk add --no-cache hugo
|
||||||
|
```
|
||||||
|
|
||||||
|
- 配置本仓库的 post-receive 钩子,内容如下
|
||||||
|
```bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
exec &> /var/log/gitea/post-receive.log
|
||||||
|
date +'[%F %T] Update www.colben.cn ...'
|
||||||
|
cd /html/www.colben.cn
|
||||||
|
env -i git pull origin master
|
||||||
|
hugo
|
||||||
|
```
|
||||||
|
|
||||||
|
- 克隆本仓库的前端目录
|
||||||
|
```bash
|
||||||
|
docker exec -ti gitea /bin/bash # 进入 gitea 容器
|
||||||
|
mkdir /html/www.colben.cn
|
||||||
|
chown gitea.www-data /html/www.colben.cn
|
||||||
|
su - gitea
|
||||||
|
cd /html/www.colben.cn
|
||||||
|
git init
|
||||||
|
git remote add -f origin https://git.colben.cn/colben/www.colben.cn.git
|
||||||
|
#git config core.sparsecheckout true
|
||||||
|
#echo 'public' > .git/info/sparse-checkout
|
||||||
|
git pull origin master
|
||||||
|
hugo
|
||||||
|
```
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user