Merge pull request #1 from micro-zoe/dev #3
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 Docs | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
deploy: | |
name: build-and-deploy | |
runs-on: ubuntu-latest | |
steps: | |
# clone 源码到工作流中 | |
- name: clone code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# 安装 node 环境 | |
- name: setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: yarn | |
- name: cache dependencies | |
uses: actions/cache@v3 | |
id: yarn-cache | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
# 安装依赖 | |
- name: install dependencies | |
if: steps.npm-cache.outputs.cache-hit != 'true' | |
run: yarn --frozen-lockfile | |
# 运行构建脚本 | |
- name: run build script | |
run: yarn build | |
# 部署 | |
- name: deploy | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
BRANCH: gh-pages | |
FOLDER: docs/.vuepress/dist |