Skip to content

Update upstream & Update CI #83

Update upstream & Update CI

Update upstream & Update CI #83

Workflow file for this run

name: build-docs
on:
# 当推送到"main"分支时触发
push:
branches: ["main"]
# 当提交Pr时触发
pull_request:
# 允许手动触发此工作流
workflow_dispatch:
env:
# 当工作流被Pr触发则显示警告
PR_PROMPT: "::warning:: 工作流由Pr拉取请求触发,构建产物不会上传、跳过页面部署任务。"
# 设置 GITHUB_TOKEN 的权限以允许部署到 GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# 仅允许一个并发部署
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
# 构建任务
build:
runs-on: ubuntu-latest
steps:
- name: 显示状态
run: echo "should_skip=${{ env.should_skip }}"
- uses: actions/checkout@v3 # 注意:使用v3
- uses: actions/setup-node@v3 # 注意:使用v3
name: 设置 Node.js
with:
node-version: latest
- name: 安装依赖
run: pnpm install
- name: 设置页面
id: pages
uses: actions/configure-pages@v3 # 注意:使用v3
- name: 运行构建脚本
run: pnpm build
- name: 上传构建产物
if: ${{ !github.head_ref }} # 需满非Pr提交
uses: actions/upload-pages-artifact@v2
with:
path: ./docs/.vuepress/dist
# 部署任务
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
if: ${{ !github.head_ref }} # 需满非Pr提交
steps:
- name: 部署到 GitHub Pages
id: deployment
uses: actions/deploy-pages@v2