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: build and deploy VuePress to GitHub Pages | |
# 检测 master 分支上的推送和 pr | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build-and-deploy-vuepress: | |
runs-on: ubuntu-latest | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Checkout | |
uses: actions/checkout@v2 | |
# Setup Node.js | |
- name: Setup Node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18' | |
- name: Get yarn cache | |
id: yarn-cache | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- name: Cache dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.yarn-cache.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
# Build VuePress | |
- name: Build | |
run: | | |
yarn install --frozen-lockfile | |
npm run docs:build | |
# Push it to gh-pahes | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.TOKEN }} | |
publish_dir: .vitepress/dist | |
cname: zkx.icu | |