diff --git a/scripts/release.js b/scripts/release.js index 1caeac5..a9d0ec3 100644 --- a/scripts/release.js +++ b/scripts/release.js @@ -12,12 +12,6 @@ const filesList = files.split( ',' ); utils.log( `Releasing ${ process.env.CIRCLE_PROJECT_REPONAME }…` ); -const shouldPublishOnNPM = Boolean( process.env.NPM_TOKEN ); - -if ( shouldPublishOnNPM ) { - utils.log( `Will publish on npm` ); -} - const getConfig = ({ gitBranchName }) => { const branchType = gitBranchName.split("/")[0]; const githubConfig = { @@ -35,6 +29,12 @@ const getConfig = ({ gitBranchName }) => { githubConfig.failComment = false; } + // Only publish alpha and release branches to NPM. + const shouldPublishOnNPM = Boolean( process.env.NPM_TOKEN ) && ["alpha", "release"].includes(branchType); + if ( shouldPublishOnNPM ) { + utils.log( `Will publish to npm.` ); + } + const config = { dryRun: otherArgs.dryRun, ci: otherArgs.ci,