Skip to content

Commit

Permalink
build: fix releases that failed halfway through npm publish actions (#…
Browse files Browse the repository at this point in the history
…28852)

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
  • Loading branch information
trop[bot] and MarshallOfSound committed Apr 27, 2021
1 parent c19f007 commit 37bcb55
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion script/release/publish-to-npm.js
Expand Up @@ -152,7 +152,13 @@ new Promise((resolve, reject) => {
resolve(tarballPath);
});
})
.then((tarballPath) => childProcess.execSync(`npm publish ${tarballPath} --tag ${npmTag} --otp=${process.env.ELECTRON_NPM_OTP}`))
.then((tarballPath) => {
const existingVersionJSON = childProcess.execSync(`npm view electron@${rootPackageJson.version} --json`).toString('utf-8');
// It's possible this is a re-run and we already have published the package, if not we just publish like normal
if (!existingVersionJSON) {
childProcess.execSync(`npm publish ${tarballPath} --tag ${npmTag} --otp=${process.env.ELECTRON_NPM_OTP}`);
}
})
.then(() => {
const currentTags = JSON.parse(childProcess.execSync('npm show electron dist-tags --json').toString());
const localVersion = rootPackageJson.version;
Expand Down

0 comments on commit 37bcb55

Please sign in to comment.