Skip to content

Commit

Permalink
更新内容+action自动部署
Browse files Browse the repository at this point in the history
  • Loading branch information
jywangyou committed Nov 25, 2023
1 parent ec8f1c4 commit c530ee4
Show file tree
Hide file tree
Showing 218 changed files with 1,140 additions and 1,062 deletions.
122 changes: 91 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,108 @@
# name: CI

# #on: [push]

# # 在master分支发生push事件时触发。
# on:
# push:
# branches:
# - master

# env: # 设置环境变量
# TZ: Asia/Shanghai # 时区(设置时区可使页面中的`最近更新时间`使用该时区时间)

# jobs:
# build: # 自定义名称
# runs-on: ubuntu-latest # 运行在虚拟机环境ubuntu-latest

# strategy:
# matrix:
# node-version: [18.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=`git remote get-url --push origin`
# 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=gh-pages
# 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.GITHUB_TOKEN}}@${remote_addr}
# git remote add origin ${remote_addr}
# git push origin HEAD:$deploy_branch --force # 推送到github $deploy_branch分支




name: CI

#on: [push]

# 在master分支发生push事件时触发
on:
# 在 master 分支发生 push 事件时触发
on:
push:
branches:
- master

env: # 设置环境变量
TZ: Asia/Shanghai # 时区(设置时区可使页面中的`最近更新时间`使用该时区时间
TZ: Asia/Shanghai # 时区(设置时区可使页面中的 最近更新时间 使用时区时间

jobs:
jobs: # 工作流
build: # 自定义名称
runs-on: ubuntu-latest # 运行在虚拟机环境ubuntu-latest
runs-on: ubuntu-latest # 必填,运行在虚拟机环境 ubuntu-latest

strategy:
matrix:
node-version: [18.x]
node-version: [14.x]

steps:
- name: Checkout # 步骤1
uses: actions/checkout@v1 # 使用的动作。格式:userName/repoName。作用:检出仓库,获取源码。 官方actions库:https://github.com/actions
steps: # 步骤1
- name: Checkout # 步骤1,拉取代码
# 使用的动作。格式:userName/repoName。作用:检出仓库,获取源码。 官方actions库:https://github.com/actions
uses: actions/checkout@v1

- name: Use Node.js ${{ matrix.node-version }} # 步骤2
uses: actions/setup-node@v3 # 作用:安装nodejs
uses: actions/setup-node@v1 # 作用:安装nodejs
with:
node-version: ${{ matrix.node-version }} # 版本
- name: Build-and-deploy # 步骤3
run: |
remote_addr=`git remote get-url --push origin`
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=gh-pages
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.GITHUB_TOKEN}}@${remote_addr}
git remote add origin ${remote_addr}
git push origin HEAD:$deploy_branch --force # 推送到github $deploy_branch分支

- name: run deploy.sh # 步骤3:执行脚本 deploy.sh
env: # 设置环境变量,未设置则不运行
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} # token
SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }} # 私钥
run: npm install && npm run deploy # 执行 deploy.sh 脚本,位于项目根目录

# - name: Push Matser To Gitee # 步骤4:GitHub 内容同步到 Gitee,同步仓库是 master
# uses: wearerequired/git-mirror-action@master
# env:
# SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }}
# with: # 从源到目的地
# source-repo: '[email protected]:Kele-Bingtang/notes-blog.git' #Github 仓库地址
# destination-repo: '[email protected]:kele-bingtang/notes-blog.git' #Gitee 仓库地址

- name: Build Gitee Pages # 步骤5:自动部署到 Gitee Pages
uses: yanglbme/gitee-pages-action@master
with:
# 注意替换为你的 Gitee 用户名
gitee-username: jywangyou
# 注意在 Settings -> Secrets 配置 GITEE_PASSWORD
gitee-password: ${{ secrets.GITEE_PASSWORD }}
# 注意替换为你的 Gitee 仓库,仓库名严格区分大小写,请准确填写,否则会出错
gitee-repo: jywangyou/notes-blog
# 要部署的分支,默认是 master,若是其他分支,则需要指定(指定的分支必须存在)
branch: gh-pages
36 changes: 18 additions & 18 deletions docs/.vuepress/components/Fantasy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -277,26 +277,26 @@
// 奇妙的屏幕大小自适应
window.onresize = function () {
// display.width = window.innerWidth;
// if (window.innerWidth / window.innerHeight > 1.8333333333333) {
// display.height = (window.innerWidth / 1980) * 1080;
// // window.scrollTo(0, (window.innerHeight - 123) / 16);
// } else {
// display.height = window.innerHeight;
// }
var devicePixelRatio = window.devicePixelRatio || 1;
display.width = window.innerWidth * devicePixelRatio;
display.height = window.innerHeight * devicePixelRatio;
// 设置画布的 CSS 尺寸为所需的尺寸
display.style.width = window.innerWidth + 'px';
display.style.height = window.innerHeight + 'px';
display.width = window.innerWidth;
if (window.innerWidth / window.innerHeight > 1.8333333333333) {
display.height = (window.innerWidth / 1980) * 1080 * devicePixelRatio;
display.height = (window.innerWidth / 1980) * 1080;
// window.scrollTo(0, (window.innerHeight - 123) / 16);
} else {
display.height = window.innerHeight;
}
// 根据 devicePixelRatio 更新上下文的比例
displayCtx.scale(devicePixelRatio, devicePixelRatio);
// var devicePixelRatio = window.devicePixelRatio || 1;
// display.width = window.innerWidth * devicePixelRatio;
// display.height = window.innerHeight * devicePixelRatio;
// // 设置画布的 CSS 尺寸为所需的尺寸
// display.style.width = window.innerWidth + 'px';
// display.style.height = window.innerHeight + 'px';
// if (window.innerWidth / window.innerHeight > 1.8333333333333) {
// display.height = (window.innerWidth / 1980) * 1080 * devicePixelRatio;
// }
// // 根据 devicePixelRatio 更新上下文的比例
// displayCtx.scale(devicePixelRatio, devicePixelRatio);
};
window.onresize();
Expand Down
2 changes: 1 addition & 1 deletion docs/.vuepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export default defineConfig4CustomTheme<VdoingThemeConfig>({

// 博主信息 (显示在首页侧边栏)
blogger: {
avatar: 'https://cdn.statically.io/gh/jywangyou/picx-images-hosting@master/xiaohei.5g9w47ni9lo0.webp',
avatar: 'https://cdn.statically.io/gh/jywangyou/picx-images-hosting@master/head.279i4ncb6yas.jpg',
name: 'Kronos',
slogan: '纵有疾风起,人生不言弃',
},
Expand Down
Loading

0 comments on commit c530ee4

Please sign in to comment.