Skip to content

增强GitHub Actions工作流:添加详细日志输出、NPM配置和切换到peaceiris/actions-gh-pages #4

增强GitHub Actions工作流:添加详细日志输出、NPM配置和切换到peaceiris/actions-gh-pages

增强GitHub Actions工作流:添加详细日志输出、NPM配置和切换到peaceiris/actions-gh-pages #4

Workflow file for this run

name: 部署到GitHub Pages
on:
push:
branches: [ main ]
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: 检出代码
uses: actions/checkout@v4
- name: 设置Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: 显示Node和NPM版本
run: |
node -v
npm -v
- name: 配置NPM
run: |
npm config set legacy-peer-deps true
npm config set fetch-retries 3
npm config set fetch-retry-mintimeout 5000
npm config set fetch-retry-maxtimeout 60000
- name: 安装依赖
run: npm install --no-fund --no-audit --verbose
- name: 查看目录结构
run: ls -la
- name: 列出包含的依赖
run: npm list --depth=0
- name: 构建
run: npm run build
- name: 部署到GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist