Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pnpm publish with provenance flag doesn't work #6607

Open
VividLemon opened this issue May 29, 2023 · 8 comments
Open

Pnpm publish with provenance flag doesn't work #6607

VividLemon opened this issue May 29, 2023 · 8 comments

Comments

@VividLemon
Copy link

pnpm version: 8.6

Code to reproduce the issue:

My previous line was pnpm publish --tag latest --filter @bootstrap-vue-next/nuxt --access=public --provenance

Expected behavior:

Publish with provenance

Actual behavior:

Did not

Additional information:

Github Action runner, ubuntu-latest , node 20

In order to fix the issue I had created this commit bootstrap-vue-next/bootstrap-vue-next@913cda8

The update worked.

The previous version that didn't worked was published at https://www.npmjs.com/package/bootstrap-vue-next/v/0.9.3 , with no provenance statement.

Today I published https://www.npmjs.com/package/bootstrap-vue-next/v/0.9.4 , with the above commit, and it worked.

@markmartirosian
Copy link

seeing the same issue

@zkochan
Copy link
Member

zkochan commented Jun 3, 2023

pnpm actually runs npm CLI for publish. So it is just passing through the --provenance option to npm. Maybe you have an old version of npm that doesn't support provenance?

@VividLemon
Copy link
Author

pnpm actually runs npm CLI for publish. So it is just passing through the --provenance option to npm. Maybe you have an old version of npm that doesn't support provenance?

It should just be whatever version is on the github actions. Assuming its not auto installed by the action, it would be whatever's included in node 20

@andrskr
Copy link

andrskr commented Jul 21, 2023

Could be helpful to add this to your package.json (you don't need to add --provenance flag in this case)

"publishConfig": {
    "access": "public",
    "provenance": true
  },

@VividLemon
Copy link
Author

I don't really know what the issue is. Nor can I really speak much to the issue as I stopped using the syntax as I preferred the https://github.com/bootstrap-vue-next/bootstrap-vue-next/blob/main/.github/workflows/release-main.yaml#L82 syntax

@Nickersoft
Copy link

Just wanted to chime in that I'm also encountering an issue where it seems like PNPM is straight-up ignoring the flags I pass to publish:

CleanShot 2024-01-03 at 10 32 47@2x

Passing the same tag and access flags to npm publish directly works fine:

CleanShot 2024-01-03 at 10 33 25@2x

@hi-ogawa
Copy link
Contributor

It looks like argument handling is quite different for "recursive publish" case and the npm flag delegations are manually done only for limited set of flags:

const appendedArgs: string[] = []
if (opts.cliOptions['access']) {
appendedArgs.push(`--access=${opts.cliOptions['access'] as string}`)
}
if (opts.dryRun) {
appendedArgs.push('--dry-run')
}
if (opts.cliOptions['otp']) {
appendedArgs.push(`--otp=${opts.cliOptions['otp'] as string}`)
}

When directly publishing .tgz, that's also in a different code path, so it's possible that the flag handling works slightly differently:

if ((params.length > 0) && params[0].endsWith('.tgz')) {
const { status } = runNpm(opts.npmPath, ['publish', ...params])
return { exitCode: status ?? 0 }
}

@ndom91
Copy link

ndom91 commented Apr 24, 2024

There's also a NPM_CONFIG_PROVENANCE: true env var you can pass during pnpm publish which should enable this. Nuxt seems to be using this method with pnpm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants