From c5961ad41501ff4f26e86484178635810c0d12d9 Mon Sep 17 00:00:00 2001 From: mcasimir Date: Tue, 15 Sep 2020 10:29:10 +0200 Subject: [PATCH] fix: skip release if is patch --- config/build.conf.js | 1 + packages/build/src/config.ts | 1 + packages/build/src/github-repo.spec.ts | 6 ++++++ packages/build/src/github-repo.ts | 5 +++++ packages/build/src/redact-config.ts | 3 ++- 5 files changed, 15 insertions(+), 1 deletion(-) diff --git a/config/build.conf.js b/config/build.conf.js index ba34c10d38..cd78b7c9f3 100644 --- a/config/build.conf.js +++ b/config/build.conf.js @@ -65,6 +65,7 @@ module.exports = { applePassword: process.env.APPLE_DEV_PASSWORD, appleAppIdentity: process.env.APPLE_APP_IDENTITY, isCi: process.env.IS_CI === 'true', + isPatch: process.env.IS_PATCH === 'true', platform: os.platform(), buildVariant: process.env.BUILD_VARIANT, repo: { diff --git a/packages/build/src/config.ts b/packages/build/src/config.ts index 15bef4b10a..3e74ba898c 100644 --- a/packages/build/src/config.ts +++ b/packages/build/src/config.ts @@ -29,4 +29,5 @@ export default interface Config { repo: string; }; dryRun?: boolean; + isPatch?: boolean; } diff --git a/packages/build/src/github-repo.spec.ts b/packages/build/src/github-repo.spec.ts index bf49c0e772..6980919f78 100644 --- a/packages/build/src/github-repo.spec.ts +++ b/packages/build/src/github-repo.spec.ts @@ -27,6 +27,12 @@ describe('GithubRepo', () => { }); describe('shouldDoPublicRelease', () => { + it('returns false when isPatch is true', async() => { + const config = { isPatch: true }; + expect(await githubRepo.shouldDoPublicRelease(config)).to.be.false; + }); + + it('returns false when branch is not master', async() => { const config = { branch: 'feature' }; expect(await githubRepo.shouldDoPublicRelease(config)).to.be.false; diff --git a/packages/build/src/github-repo.ts b/packages/build/src/github-repo.ts index 51b9d909c7..d69a67fbde 100644 --- a/packages/build/src/github-repo.ts +++ b/packages/build/src/github-repo.ts @@ -162,6 +162,11 @@ export class GithubRepo { * current version matches current revision. */ async shouldDoPublicRelease(config: Config): Promise { + if (config.isPatch) { + console.info('mongosh: skip public release: is a patch'); + return false; + } + if (config.branch !== 'master') { console.info('mongosh: skip public release: is not master'); return false; diff --git a/packages/build/src/redact-config.ts b/packages/build/src/redact-config.ts index db3dfa5b84..f618e4a785 100644 --- a/packages/build/src/redact-config.ts +++ b/packages/build/src/redact-config.ts @@ -14,6 +14,7 @@ export function redactConfig(config: Config): any { branch: config.branch, isCi: config.isCi, platform: config.platform, - repo: config.repo + repo: config.repo, + isPatch: config.isPatch }; }