Skip to content

Merge pull request #18 from mjlmton/patch-3 #151

Merge pull request #18 from mjlmton/patch-3

Merge pull request #18 from mjlmton/patch-3 #151

Workflow file for this run

name: 生成 Vuepress 网站并部署
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# https://github.com/marketplace/actions/setup-node-js-environment
# 设置 nodejs 版本为 14.x,太高会运行出错
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '14'
# 缓存的使用:https://github.com/marketplace/actions/cache
# 获取 yarn 的缓存目录
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
# 恢复缓存,在作业成功后,会自动上传或更新缓存
- name: Restore Yarn dependencies from cache
uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-
- name: yarn run docs:build
run: yarn install && yarn run docs:build
# https://github.com/marketplace/actions/github-pages-action
# 部署
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build/.vuepress/dist