Git Push 2 Homepage

ibug的网站部署思路

  1. 基于ibug.github.io
  2. 图片markdown两个仓库
  3. 对于acsa的网站
    1. 设置了action产生public/*.html
    2. 通过webhook来实现,服务器接收仓库的event信息。
      1. acsa的nginx接收location转发snode5
      2. snode5的nginx转发到127.0.0.2:9000上
      3. webhook.service接收到信息,然后git clone。并返回信息

hugo网站的action文件

根据公开的仓库,hugo的html文件会产生在gh-pages分支下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
name: build

on:
push:
branches: [master]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
#submodules: true # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod

- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
#extended: true

- name: Build
run: hugo --minify

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/master'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public

webhook的实现

接收端转发到内网的机器上(通过修改vim /etc/nginx/sites-enabled/default

1
2
3
4
5
6
server{
location /_webhook/ {
proxy_pass http://snode5.swangeese.fun;
proxy_set_header Host $http_host;
}
}

记得reload systemctl reload nginx

Nginx中location的作用是根据Url来决定怎么处理用户请求(转发请求给其他服务器处理或者查找本地文件进行处理)。location支持正则表达式,配置十分灵活。我们可以在一个虚拟主机(nginx中的一个server节点)下配置多个location以满足如动静分离,防盗链等需求。

在snode5上nginx也需要转发

1
2
3
location /_webhook/ {
proxy_pass http://127.0.0.2:9000;
}

需要进一步的研究学习

暂无

遇到的问题

暂无

开题缘由、总结、反思、吐槽~~

参考文献

Author

Shaojie Tan

Posted on

2022-06-27

Updated on

2025-01-30

Licensed under