Skip to content

build(xhr-promisify): 构建报错 #5

build(xhr-promisify): 构建报错

build(xhr-promisify): 构建报错 #5

Workflow file for this run

# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages
on:
# Runs on pushes targeting the default branch
pull_request:
branches: [main] # pull request 时触发
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
base_url: /util/
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 检出代码
uses: actions/checkout@v4
with:
fetch-depth: 0 # 获取完整提交历史(用于 gh-pages 提交记录)
- name: 安装Node环境
uses: actions/setup-node@v4
with:
node-version: 20 # 指定 Node.js 版本
- run: npm run clean
- run: npm i
- run: npm run docs:build # 执行构建命令(生成 dist/ 目录)
env:
BASE_URL: ${{ env.base_url }}
- name: 配置 Pages
id: configuration
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: './docs/.vitepress/dist'
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
steps:
# - name: Deploy to GitHub Pages
# uses: peaceiris/actions-gh-pages@v4
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }} # 自动生成的 GitHub Token
# publish_dir: ./docs/.vitepress/dist # 构建产物目录
# keep_files: false # 是否保留 gh-pages 现有文件
# force_orphan: true # 强制清空历史(仅保留最新部署)
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4