docs: backup #73
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: deploy-gh-pages | |
on: | |
push: | |
branches: | |
- main # 只在 main 分支上 push 触发部署 | |
paths-ignore: # 下列文件的变更不触发部署,可以自行添加 | |
- README.md | |
- LICENSE | |
pull_request: | |
branches: | |
- main # 只在 main 分支上的 PR 合并时触发部署 | |
types: [closed] | |
jobs: | |
deploy-gh-pages: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
repo-token: ${{ secrets.DEPLOY_TOKEN }} | |
# 如果需要 Git 子模块,取消注释下一行 | |
# submodules: true | |
- name: 设置 Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: npm # 使用 npm 缓存 | |
- name: 安装依赖 | |
run: npm ci | |
- name: 构建网站 | |
env: | |
NODE_OPTIONS: --max_old_space_size=8192 | |
run: |- | |
npm run build | |
> dist/.nojekyll | |
- name: 部署网站 | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
# 文档部署到的分支名称 | |
GITHUB_TOKEN: ${{ secrets.DEPLOY_TOKEN }} | |
BRANCH: gh-pages # 部署到的分支名称 | |
FOLDER: dist/ | |
CLEAN: true |