Skip to content

Commit

Permalink
feat: support npm publish --provenance
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed May 29, 2023
1 parent 8d2469e commit d20b59c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/node-release.yml
Expand Up @@ -33,6 +33,8 @@ on:

jobs:
Release:
permissions:
id-token: write
runs-on: ubuntu-latest
defaults:
run:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scripts/release/index.js
Expand Up @@ -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);
Expand Down

0 comments on commit d20b59c

Please sign in to comment.