Skip to content

Deploy

Deploy #96

Workflow file for this run

# .github > workflows > deploy.yml
name: Deploy
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16
cache: npm
- run: npm install --frozen-lockfile
- name: Build
run: npm run docs:build
- name: Deploy
# 将构建产物 commit 到一个分支上,用于发布静态站点资源
# https://github.com/peaceiris/actions-gh-pages
#不要将peaceiris改为自己的仓库名,我单纯的以为这个需要改成自己的仓库名,部署上去就build失败了,需引用该仓库的配置
uses: peaceiris/actions-gh-pages@v3
with:
# Github 会在 workflow 中自动生成 GIHUBT_TOKEN,用于认证 workflow 的运行
github_token: ${{ secrets.GITHUB_TOKEN }}
# 静态资源目录设置
publish_dir: docs/.vitepress/dist
# 默认发布到 gh-pages 分支上,可以指定特定的发布分支(不能选拉取代码的分支)
publish_branch: gh-pages
full_commit_message: ${{ github.event.head_commit.message }}