Skip to content
Open
Prev Previous commit
fix(ci): 锁定 Node 25.9.0 / pnpm 9.15.0 并升级流水线
  • Loading branch information
mmdapl committed Sep 22, 2026
commit d53adf1a4b005848bd1f7bf147eba553a06adc9d
41 changes: 21 additions & 20 deletions .github/workflows/CD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ env:
# vercel
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
# Node / pnpm 版本与 package.json、.nvmrc 保持一致
NODE_VERSION: 25.9.0
PNPM_VERSION: 9.15.0

# 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages
permissions:
Expand All @@ -27,32 +30,31 @@ jobs:
# 部署到Github-Pages
deploy-github:
name: 部署到Github-Pages
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
if: github.repository == '142vip/JavaScriptCollection'

steps:
- name: Checkout Code
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
persist-credentials: false
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
fetch-depth: 0

# 安装PNPM
# 安装 PNPM(版本与 package.json packageManager 一致)
- name: PNPM Install
uses: pnpm/action-setup@v4
uses: pnpm/action-setup@v5
with:
version: 9.15.0
version: ${{ env.PNPM_VERSION }}

# 安装Node环境
# 安装 Node 环境(版本与 .nvmrc / engines.node 一致)
- name: Install Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v5
with:
node-version: 20.16.0
# 缓存
node-version: ${{ env.NODE_VERSION }}
cache: pnpm

- name: Install Dependencies
Expand All @@ -64,42 +66,41 @@ jobs:
run: pnpm build:proxy

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
uses: actions/upload-pages-artifact@v4
with:
path: .vuepress/dist

# 部署
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@v5

# 版本发布
release:
name: 创建Github发布
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
# 主库next且执行release更新时执行
if: github.repository == '142vip/JavaScriptCollection' && startsWith(github.event.head_commit.message, 'chore(release):')

steps:
- name: Checkout Code
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
persist-credentials: false
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
fetch-depth: 0

# 安装PNPM
# 安装 PNPM(版本与 package.json packageManager 一致)
- name: PNPM Install
uses: pnpm/action-setup@v4
uses: pnpm/action-setup@v5
with:
version: 9.15.0
version: ${{ env.PNPM_VERSION }}

# 安装Node环境
# 安装 Node 环境(版本与 .nvmrc / engines.node 一致)
- name: Install Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v5
with:
node-version: 20.16.0
# 缓存
node-version: ${{ env.NODE_VERSION }}
cache: pnpm

- name: Install Dependencies
Expand Down
20 changes: 11 additions & 9 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,36 +25,38 @@ env:
# 阿里云仓库信息
REGISTRY: registry.cn-hangzhou.aliyuncs.com
UserName: 142vip
# Node / pnpm 版本与 package.json、.nvmrc 保持一致
NODE_VERSION: 25.9.0
PNPM_VERSION: 9.15.0

jobs:
Base-Build:
name: 基础编译构建
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
if: github.repository == '142vip/JavaScriptCollection' && github.event_name == 'pull_request'
permissions:
actions: read
pull-requests: read

steps:
- name: Checkout Code
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
persist-credentials: false
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
fetch-depth: 0

# 安装PNPM
# 安装 PNPM(版本与 package.json packageManager 一致)
- name: PNPM Install
uses: pnpm/action-setup@v4
uses: pnpm/action-setup@v5
with:
version: 9.15.0
version: ${{ env.PNPM_VERSION }}

# 安装Node环境
# 安装 Node 环境(版本与 .nvmrc / engines.node 一致)
- name: Install Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v5
with:
node-version: 20.16.0
# 缓存
node-version: ${{ env.NODE_VERSION }}
cache: pnpm

# 下载依赖并执行初始化脚本
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ on:
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v5

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ENV NODE_OPTIONS="--max-old-space-size=200000"
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"

## corepack 环境变量,在CI脚本中直接设置
# 构建阶段使用 infra 基础镜像(含 Node 25 + corepack),pnpm 版本由 package.json 的 packageManager 锁定
#ENV COREPACK_NPM_REGISTRY=https://mirrors.tencent.com/npm/

WORKDIR /apps
Expand Down
Loading