From d20b59c19cb423c8ef86678852e0267098f3eeee Mon Sep 17 00:00:00 2001 From: fengmk2 Date: Mon, 29 May 2023 16:49:47 +0800 Subject: [PATCH] feat: support npm publish --provenance https://github.com/pnpm/pnpm/issues/6435 --- .github/workflows/node-release.yml | 3 +++ scripts/release/index.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/node-release.yml b/.github/workflows/node-release.yml index 2c8597b..5dcd7e8 100644 --- a/.github/workflows/node-release.yml +++ b/.github/workflows/node-release.yml @@ -33,6 +33,8 @@ on: jobs: Release: + permissions: + id-token: write runs-on: ubuntu-latest defaults: run: @@ -83,6 +85,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} DRYRUN: ${{ inputs.dryRun }} + NPM_CONFIG_PROVENANCE: true - name: Publish ${{ steps.release.outputs.name }}@${{ steps.release.outputs.release_version }} if: steps.release.outputs.release_version && !inputs.dryRun diff --git a/scripts/release/index.js b/scripts/release/index.js index 0410e58..f53f978 100644 --- a/scripts/release/index.js +++ b/scripts/release/index.js @@ -43,7 +43,7 @@ async function run() { core.setOutput('release_version', nextRelease.version); // cnpm sync - const res = await request(`https://registry-direct.npmmirror.com/-/package/${pkgInfo.name}/syncs`, { method: 'PUT' }); + const res = await request(`https://registry.npmmirror.com/-/package/${pkgInfo.name}/syncs`, { method: 'PUT' }); const { id } = await res.body.json(); const logUrl = `https://registry.npmmirror.com/-/package/${pkgInfo.name}/syncs/${id}/log`; core.setOutput('cnpm_sync_url', logUrl);