chore: update README #6
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 | |
# 当 master 分支 push 代码的时候触发 workflow | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# 下载仓库代码 | |
- uses: actions/checkout@v2 | |
# 缓存依赖 | |
- name: Get yarn cache | |
id: yarn-cache | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- uses: actions/cache@v1 | |
with: | |
path: ${{ steps.yarn-cache.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
# 安装依赖 | |
- run: yarn | |
# 打包构建 | |
- run: yarn build | |
# 发布到 GitHub Pages | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v2 | |
env: | |
PERSONAL_TOKEN: ${{ secrets.ACCESS_TOKEN }} # 访问秘钥 | |
PUBLISH_BRANCH: gh-pages # 推送分支 | |
PUBLISH_DIR: ./dist # 部署目录 |