# 关于发布
# 服务器准备
# 1.新建一个github静态网站项目<userName>.github.io
这一步忽略
# 2. 购买一个服务器
这一步也忽略
域名解析 https://www.cnblogs.com/liangmingshen/p/9561994.html
# 发布
# 发布到<userName>.github.io的静态博客
- 在项目新建一个deploy.sh脚本
#!/usr/bin/env sh
# 确保脚本抛出遇到的错误
set -e
# 生成静态文件
npm run docs:build
# 进入生成的文件夹
cd dist
# 如果是发布到自定义域名
# echo 'www.example.com' > CNAME
git init
git add -A
git commit -m 'deploy'
# 如果发布到 https://<USERNAME>.github.io USERNAME=你的用户名
git push -f git@github.com:<USERNAME>/<USERNAME>.github.io.git master
# 如果发布到 https://<USERNAME>.github.io/<REPO> REPO=github上的项目
# git push -f git@github.com:<USERNAME>/<REPO>.git master:gh-pages
cd -