一键发布更新内容到vdoing网站 原创
刺激
版权
自己写的。
环境
自己开源的 《vuepress-theme-vdoing-one-public》网站模板。
此模板是在Young Kbt blog的开源项目《Kele-Bingtang.github.io》基础上修改为自己的风格而成,感谢大佬开源的模板&感谢原作者开源的vdoing主题。❤️❤️
背景
NOTE
你想一键推送自己本地知识库更新内容到网站吗?
行的话,只需要粘贴执行以下脚本就好。😂
执行脚本
拉取仓库后在vscode里需要做的配置:
拉取项目后,直接在vscode里执行如下代码就好:
bash
cat >>/etc/profile <<EOF
alias nd="
sh -x /d/vuepress-theme-vdoing-one-private/shell/vdoing-run-dev.sh
"
EOF
cat >>/etc/profile <<EOF
alias nb="
sh -x /d/vuepress-theme-vdoing-one-private/shell/vdoing-run-build.sh
"
EOF
cat >>/etc/profile <<EOF
alias xyy="
sh -x /d/vuepress-theme-vdoing-one-private/shell/vdoing.sh
"
EOF
cat >>/etc/profile <<EOF
alias gs="
cd /d/vuepress-theme-vdoing-one-private/
git status
"
EOF
cat >>/etc/profile <<EOF
alias gp="
cd /d/vuepress-theme-vdoing-one-private/
git pull
"
EOF
cat >>/etc/profile <<EOF
alias gg="
cd /d/vuepress-theme-vdoing-one-private/
git status
git pull
git add -A
git commit -m'commit data'
git push
git status
"
EOF
source /etc/profile
测试过程
案例:shell脚本一键完成vdoing-提交+构建+推送工作流
环境
2024年12月23日测试
基于官方https://github.com/xugaoyi/vuepress-theme-vdoing
搭建的仓库。
代码配置
D:\vuepress-theme-vdoing-one\shell\vdoing.sh
bash
#!/bin/bash
#提交
cd /d/vuepress-theme-vdoing-one
git pull
git add -A
git commit -m"update data"
git push
#构建
cd /d/vuepress-theme-vdoing-one
npm run build:win
echo "推送winodws site数据到ecs:"
/d/vuepress-theme-vdoing-one/shell/vdoing.bat
echo "rsync: rsync数据winodws-->ecs推送成功!"
echo ""
echo ""
D:\vuepress-theme-vdoing-one\shell\vdoing.bat
bat
::添加自己要执行的任务
echo Push winodws docusaurus static data to ecs...
rsync.exe -avPzruh --delete --port 8730 --password-file=/cygdrive/D/docusaurus/resource/shell/password.txt /cygdrive/D/vuepress-theme-vdoing-one/docs/.vuepress/dist root@云服务器ip::cmi-vue/
自己vscode配置:
bash
cat >>/etc/profile <<EOF
alias xyy="
sh -x /d/vuepress-theme-vdoing-one/shell/vdoing.sh
"
EOF
source /etc/profile
当前状态
一键执行xyy
命令
效果
网站观察效果
之前新增的内容出现了:(完美😜)
构建别名
nd
nb
😜
shell代码
bash
cat >>/d/vuepress-theme-vdoing-one/shell/vdoing-run-dev.sh <<EOF
cd /d/vuepress-theme-vdoing-one/
npm run dev:win
"
EOF
cat >>/etc/profile <<EOF
alias nd="
sh -x /d/vuepress-theme-vdoing-one/shell/vdoing-run-dev.sh
"
EOF
source /etc/profile
cat >>/d/vuepress-theme-vdoing-one/shell/vdoing-run-build.sh <<EOF
cd /d/vuepress-theme-vdoing-one/
npm run build:win
"
EOF
cat >>/etc/profile <<EOF
alias nb="
sh -x /d/vuepress-theme-vdoing-one/shell/vdoing-run-build.sh
"
EOF
source /etc/profile
测试效果
完美。😜