Update README.md #8
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: Button Github Actions | |
# 当 master 分支 push 代码的时候触发 workflow | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# 下载仓库代码 / 校验 | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# 安装 pnpm | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 6 | |
# 安装 node pnpm | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
cache: 'pnpm' | |
# 安装依赖项 | |
- name: Install | |
run: pnpm i | |
# 打包文档 | |
- name: Build | |
run: pnpm build | |
# 创建并提交 CNAME 文件 | |
- name: Create CNAME file | |
run: echo 'button.tianyuhao.cn' > dist/CNAME | |
- name: Commit CNAME file | |
run: | | |
git config --local user.email '[email protected]' | |
git config --local user.name 'Tyh2001' | |
git add -f dist/CNAME | |
# 向 Codecov 报告覆盖率 | |
- name: Report coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
# https://github.com/peaceiris/actions-gh-pages#readme | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: dist |