semantic-release / npm

:ship: semantic-release plugin to publish a npm package
MIT License
244 stars 114 forks source link

`prepack` run twice when set `tarballDir` #535

Open atian25 opened 1 year ago

atian25 commented 1 year ago
module.exports = {
  plugins: [
    [ '@semantic-release/commit-analyzer', { } ],
    [ '@semantic-release/release-notes-generator', { } ],
    [ '@semantic-release/changelog', {
      changelogTitle: '# Changelog',
    } ],
    [ '@semantic-release/npm', {
      tarballDir: '.semantic-release',
    } ],
    [ '@semantic-release/exec', {
      'publishCmd': 'ls -l dist && ls -l .semantic-release && tar -ztvf .semantic-release/*.tgz',
    } ],
    [ '@semantic-release/git', { } ],
    [ '@semantic-release/github', {
      addReleases: 'bottom',
      assets: '.semantic-release/*.tgz',
    } ],
  ],
};

see the log: https://github.com/atian25/github-actions-test/actions/runs/3672673923/jobs/6209067073

the reason is when set tarballDir, this plugin will exec npm pack first then npm publish (see https://github.com/semantic-release/npm/blob/master/lib/prepare.js#LL24C20-L24C20)

Suggest: when set tarballDir, then just npm publish {path/to/pack_dist}.tgz , so the npm publish will not trigger prepack again

atian25 commented 1 year ago

and when the prepack fail, the rest plugin's fail step can't process with it, due to un-wrapped error