diff --git a/dist/index.js b/dist/index.js index 957015c..45228b7 100644 --- a/dist/index.js +++ b/dist/index.js @@ -6978,9 +6978,20 @@ __webpack_require__.r(__webpack_exports__); let cli; let cliPath; let release; + try { + await fs__WEBPACK_IMPORTED_MODULE_3__.promises.access('lerna.json'); + cli = 'lerna'; + release = lernaRelease; + _actions_core__WEBPACK_IMPORTED_MODULE_0__.info('Lerna detected, releasing using lerna'); + } + catch (_) { + cli = 'semantic-release'; + release = semanticRelease; + _actions_core__WEBPACK_IMPORTED_MODULE_0__.info('Lerna not detected, releasing using semantic-release'); + } try { const pkg = JSON.parse((await fs__WEBPACK_IMPORTED_MODULE_3__.promises.readFile('package.json')).toString()); - privatePackage = pkg.private || false; + privatePackage = cli !== 'lerna' && pkg.private; scope = pkg.name.slice(0, pkg.name.indexOf('/')); publishToGithub = publish && !privatePackage && scope === ownerScope; publishToNPM = publish && !privatePackage && !!npmToken; @@ -6991,17 +7002,6 @@ __webpack_require__.r(__webpack_exports__); publishToGithub = false; publishToNPM = false; } - try { - await fs__WEBPACK_IMPORTED_MODULE_3__.promises.access('lerna.json'); - cli = 'lerna'; - release = lernaRelease; - _actions_core__WEBPACK_IMPORTED_MODULE_0__.info('Lerna detected, releasing using lerna'); - } - catch (_) { - cli = 'semantic-release'; - release = semanticRelease; - _actions_core__WEBPACK_IMPORTED_MODULE_0__.info('Lerna not detected, releasing using semantic-release'); - } if (!publish) { _actions_core__WEBPACK_IMPORTED_MODULE_0__.info('Publishing disabled, skipping publishing to package registries'); } diff --git a/src/index.ts b/src/index.ts index 5b84a97..6b2b1c5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -24,19 +24,6 @@ import { promises as fs } from 'fs' env?: { [variable: string]: string } ) => Promise - try { - const pkg = JSON.parse((await fs.readFile('package.json')).toString()) - privatePackage = pkg.private || false - scope = pkg.name.slice(0, pkg.name.indexOf('/')) - publishToGithub = publish && !privatePackage && scope === ownerScope - publishToNPM = publish && !privatePackage && !!npmToken - } catch (_) { - privatePackage = true - scope = ownerScope - publishToGithub = false - publishToNPM = false - } - try { await fs.access('lerna.json') cli = 'lerna' @@ -54,6 +41,19 @@ import { promises as fs } from 'fs' ) } + try { + const pkg = JSON.parse((await fs.readFile('package.json')).toString()) + privatePackage = cli !== 'lerna' && pkg.private + scope = pkg.name.slice(0, pkg.name.indexOf('/')) + publishToGithub = publish && !privatePackage && scope === ownerScope + publishToNPM = publish && !privatePackage && !!npmToken + } catch (_) { + privatePackage = true + scope = ownerScope + publishToGithub = false + publishToNPM = false + } + if (!publish) { core.info( 'Publishing disabled, skipping publishing to package registries'