前一阵子吧,有段时间Cloudflare连通性较差,想着将github pages的静态页面搬到serv00上去。
本文记录一些遇到的问题。
同步内容:仓库分支
部分项目直接使用某分支作为Github pages
# 克隆指定分支,并将其作为当前分支
git clone -b <branch_name> <remote_repository_url> <local_directory_name>
# 从当前分支关联的远程分支拉取更新:
git pull
同步内容:Workflow Action打包
部分项目在Github Actions中生成内容并上传,Github Pages并没有体现在分支中。
我们需要在内容生成后添加一个到Release Assets的操作。
以后直接拉取Release Assets就行了。
文件的新旧可以使用版本号来标识,需要自行处理。
# see https://github.com/nICEnnnnnnnLee/BilibiliDown/commit/a51cb56e2ac7ed1123093e88c911484a7b65b54f
- name: zip and upload to Github assets
env:
REPO: "nICEnnnnnnnLee/BilibiliDown"
TAG: "V4.5"
TOKEN: ${{ secrets.GITHUB_TOKEN }}
ASSET_NAME: "BilibiliDownDocs.zip"
FILE_PATH: "BilibiliDownDocs.zip"
run:
zip -r BilibiliDownDocs.zip docs/.vitepress/dist/
chmod +x gh_up.sh
./gh_up.sh
htaccess
想要通过不带.html
后缀的路径名中文件,需要修改.htaccess
参考https://docs.serv00.com/htaccess/
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html