diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 55859c6..2cea59b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,14 @@ name: build -on: [pull_request, push] +on: + pull_request: + push: + branches: + - master + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true permissions: contents: read @@ -10,21 +18,23 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: ['20', '22', '24'] + node-version: ['22', '24'] steps: - name: Checkout uses: actions/checkout@v6.0.2 - - name: Setup Node.js environment - uses: actions/setup-node@v6.3.0 - with: - node-version: ${{ matrix.node-version }} - - name: Setup PNPM uses: pnpm/action-setup@v6.0.8 with: version: 11.27.1 + - name: Setup Node.js environment + uses: actions/setup-node@v6.3.0 + with: + node-version: ${{ matrix.node-version }} + cache: pnpm + cache-dependency-path: pnpm-lock.yaml + - name: Install modules and build projects run: pnpm install --frozen-lockfile && pnpm run build @@ -52,25 +62,24 @@ jobs: Lint: runs-on: ubuntu-latest - strategy: - matrix: - node-version: ['20', '22', '24'] steps: - name: Checkout uses: actions/checkout@v6.0.2 - - name: Setup Node.js environment - uses: actions/setup-node@v6.3.0 - with: - node-version: ${{ matrix.node-version }} - - name: Setup PNPM uses: pnpm/action-setup@v6.0.8 with: version: 11.27.1 - - name: Install modules and build projects - run: pnpm install --frozen-lockfile && pnpm run build + - name: Setup Node.js environment + uses: actions/setup-node@v6.3.0 + with: + node-version: '22' + cache: pnpm + cache-dependency-path: pnpm-lock.yaml - - name: Run tests + - name: Install modules + run: pnpm install --frozen-lockfile + + - name: Run lint run: pnpm run lint diff --git a/README.md b/README.md index 01472a5..c1d8267 100644 --- a/README.md +++ b/README.md @@ -153,7 +153,7 @@ pnpm run test:mdx3 ### 环境要求 -- Node.js >= 20 +- Node.js >= 22 - pnpm 11(参见 `packageManager` 字段) ```bash diff --git a/package.json b/package.json index d38ee00..a12e121 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "sideEffects": false, "packageManager": "pnpm@11.27.1", "engines": { - "node": ">=20" + "node": ">=22" }, "main": "./dist/lint-md-parser.cjs", "module": "./dist/lint-md-parser.mjs",