From bdff74a0a7f8ab009cb02c4b63a9731f48237791 Mon Sep 17 00:00:00 2001 From: cluic Date: Tue, 19 May 2026 19:56:46 +0800 Subject: [PATCH] Adjust npm trusted publishing workflow --- .github/workflows/release-preflight.yml | 7 +++---- .github/workflows/release.yml | 18 +++++++++++++----- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release-preflight.yml b/.github/workflows/release-preflight.yml index 733fe80..952ed1d 100644 --- a/.github/workflows/release-preflight.yml +++ b/.github/workflows/release-preflight.yml @@ -26,11 +26,10 @@ jobs: fetch-depth: 0 - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: - node-version: 22 - cache: npm - cache-dependency-path: node/package-lock.json + node-version: 24 + package-manager-cache: false - name: Install dependencies run: npm ci diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cdca31a..cf25dd1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,12 +23,10 @@ jobs: fetch-depth: 0 - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: - node-version: 22 - cache: npm - cache-dependency-path: node/package-lock.json - registry-url: https://registry.npmjs.org + node-version: 24 + package-manager-cache: false - name: Install dependencies run: npm ci @@ -36,6 +34,15 @@ jobs: - name: Run tests if present run: npm run test --if-present + - name: Prepare npm for trusted publishing + run: | + rm -f "${NPM_CONFIG_USERCONFIG:-$HOME/.npmrc}" + cat <<'EOF' > "$HOME/.npmrc" + registry=https://registry.npmjs.org/ + EOF + echo "NPM_CONFIG_USERCONFIG=$HOME/.npmrc" >> "$GITHUB_ENV" + echo "NODE_AUTH_TOKEN=" >> "$GITHUB_ENV" + - name: Create release PR or publish uses: changesets/action@v1 with: @@ -46,3 +53,4 @@ jobs: commit: Release @cluic/codex-remote-proxy env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NODE_AUTH_TOKEN: ""