Test Github pages from MWeb
测试从MWeb发布文章到Github Pages Github Source
cao7113.github.io绑定到个人域名shareup.me
1 在github站点settings里设置custom domain,会自动在仓库根目录添加CNAME文件
2 域名dns配置CNAME记录
3 测试 dig www.shareup.me +nostats +nocomments +nocmd
; 如果使用apex domain,测试 dig shareup.me +noall +answer
MWeb中通过脚本自动发布过程探索
右键网站分类,选择 “复制发布脚本命令并打开终端(Terminal)...” 粘贴到剪切板的发布脚本如下:
cd "/Users/xxx/data/mweb/static-website/github-pages" && \
sh "/Users/xxx/Library/Containers/com.coderforart.MWeb3/Data/Library/Application Support/site_publish_logs/sh_15878256210134.sh" && \
open ""
上面的发布 site_publish_logs/sh_15878256210134.sh
就是在静态网站生成时配置的发布脚本
➜ github-pages git:(master) ✗ cat "/Users/xxx/Library/Containers/com.coderforart.MWeb3/Data/Library/Application Support/site_publish_logs/sh_15878256210134.sh"
#!/bin/sh
# Please set the name and email.
# Because MWeb can't get your github global setting.
git config user.name “xxx”
git config user.email “xxx@gmail.com”
git add --ignore-removal .
git commit -m "2020-04-25 23:35:32"
git push -u origin master
打开命令行终端自动执行(免去粘贴命令步骤)的方法,将下面的脚本放入~/.zshrc
或~/.bashrc
,参https://gist.github.com/bramblex/a6b12543a076e2c1fa5acecb95f51ead
if (pbpaste | grep -Eq '^cd "[^"]*" && sh "[^"]*/site_publish_logs/sh_\d*\.sh" && open "[^"]*"')
then
echo "========== MWEB AUTO PUBLISH START =========="
echo "Runing command:"
pbpaste
if pbpaste | sh
then
echo "Success!"
echo "Clean pasteboard..."
echo -n "" | pbcopy
echo "========== MWEB AUTO PUBLISH END =========="
echo "Close terminal 5s later..."
sleep 5
exit
else
echo "Failed!"
echo "Clean pasteboard..."
echo -n "" | pbcopy
echo "========== MWEB AUTO PUBLISH END =========="
fi
fi
亲测有效!
参考文章
https://zh.mweb.im/how_to_use_shell_script.html
https://pages.github.com/
2020/04/25
Copyright © 2015 Powered by MWeb, Theme used GitHub CSS.