cnblogs 迁移项目
# create `static-website`
$ npm init gatsby
# 1. 交互式, 问答确认, ts & project-name
# 使用 `&&` 串行执行多个 Linux Shell 命令
$ cd static-website && gatsby develop
$ gatsby build
$ gatsby serve
CLI
flags
# ts version
$ npm init gatsby -y -ts my-site-name
# 2. 命令式, -y 无需交互问答确认, 直接指定 ts & project-name
https://github.com/gatsbyjs/gatsby-starter-minimal
https://github.com/gatsbyjs/gatsby-starter-minimal-ts
/static/CNAME
✅- custom domain
https://gatsby-react-app.xgqfrms.xyz/
https://abc.xgqfrms.xyz/gatsby-react-app/
-
手动复制 readme 到 static 文件夹
-
gatsby build 会自动把 static 文件夹下的文件复制到 构建出来的 public 文件下
-
所以 Action 只要指定 CI/CD 发布部署的根目录 folder 为 public 即可
"scripts": {
"copy": "cp ./README.md ./static/",
"deploy": "npm run copy && gatsby build",
},
# ...
- name: Deploy to gh-pages 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: public
# The folder the action should deploy.
token: ${{ secrets.ACCESS_TOKEN }}