迁移到 Vdoing后一些记录
# 迁移到 Vdoing后一些记录
# 整体架构
# 本地源码
Vdoing的预览及上传使用的WebStorm,Markdown文档编辑使用的Typora,图片上传使用的PicList,图床使用腾讯云部署的AList的Webdav。
# GitHub Page部署
本地代码上传到GitHub仓库后,将通过项目.github/workflows/ci.yml自动触发Actions进行项目的一个编译打包的工作,最后将文件上传到GitHub Page进行部署。
name: CI
#on: [push]
# 在master分支发生push事件时触发。
on:
push:
branches:
- main
env: # 设置环境变量
TZ: Asia/Shanghai # 时区(设置时区可使页面中的`最近更新时间`使用该时区时间)
jobs:
build: # 自定义名称
runs-on: ubuntu-latest # 运行在虚拟机环境ubuntu-latest
strategy:
matrix:
node-version: [21.x]
steps:
- name: Checkout # 步骤1
uses: actions/checkout@v1 # 使用的动作。格式:userName/repoName。作用:检出仓库,获取源码。 官方actions库:https://github.com/actions
- name: Use Node.js ${{ matrix.node-version }} # 步骤2
uses: actions/setup-node@v3 # 作用:安装nodejs
with:
node-version: ${{ matrix.node-version }} # 版本
- name: Build-and-deploy # 步骤3
run: |
remote_addr=https://github.com/iworthy/iworthy.github.io.git
commit_info=`git describe --all --always --long`
user_name=`git log -1 --pretty=format:'%an'`
user_email=`git log -1 --pretty=format:'%ae'`
deploy_branch=master
yarn
yarn build
cd docs/.vuepress/dist
git config --global init.defaultBranch $deploy_branch
git init
git config user.name ${user_name}
git config user.email ${user_email}
git add -A
git commit -m "auto deploy, $commit_info"
remote_addr=`echo $remote_addr | awk -F'://' '{print $2}'`
remote_addr=https://${user_name}:${{secrets.ACCESS_TOKEN}}@${remote_addr}
git remote add origin ${remote_addr}
git push origin HEAD:$deploy_branch --force # 推送到github $deploy_branch分支
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# 腾讯云CVM部署
每日执行定时任务拉取代码部署到服务器Nginx对应目录下。
#!/bin/bash
cd /data/wwwroot/www.worthy.cc
rm -rf *
git clone git@github.com:iworthy/iworthy.github.io.git
1
2
3
4
5
2
3
4
5
# DNS解析
使用DNSPod解析,根据线路类型将境外的解析到了GitHub Page,默认解析为腾讯云CVM,实现了同一域名两处部署。
上次更新: 2024/07/03, 22:01:24