From 72d74602f861c1c50b6a4ab625c0f03d0da563e8 Mon Sep 17 00:00:00 2001 From: Adam Dierkens Date: Fri, 15 Jul 2022 13:17:40 -0700 Subject: [PATCH] Get correct next version when using onlyGraduateWithReleaseLabel shipit option --- plugins/version-file/src/index.ts | 10 +++++++++- yarn.lock | 26 +++++++++++++++----------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/plugins/version-file/src/index.ts b/plugins/version-file/src/index.ts index 87a16c74e..c436f22ba 100644 --- a/plugins/version-file/src/index.ts +++ b/plugins/version-file/src/index.ts @@ -160,15 +160,23 @@ export default class VersionFilePlugin implements IPlugin { // Figure out next version const lastRelease = await auto.git!.getLatestRelease(); + const currentBranch = await getCurrentBranch(); + + const latestTagInBranch = await (currentBranch === auto.baseBranch + ? auto.git?.getLatestTagInBranch() + : auto.git?.getLastTagNotInBaseBranch(prereleaseBranch)); + const latestTag = - (await auto.git?.getLastTagNotInBaseBranch(prereleaseBranch)) || + latestTagInBranch || (await getPreviousVersion(auto, this.versionFile)); + const nextVersion = determineNextVersion( lastRelease, latestTag, bump, prereleaseBranch ); + const prefixedVersion = auto.prefixRelease(nextVersion); preReleaseVersions.push(prefixedVersion); diff --git a/yarn.lock b/yarn.lock index fd3b613b6..e5866ea77 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13,10 +13,10 @@ integrity sha512-K1kQv1BZVtMXQqdpNZt9Pgh85KwamsWX9gYyq1xG4cpyb+EacfMiNfumrju16piFXanCUrCR0P1DowPjV2qV/A== "@auto-it/bot-list@link:packages/bot-list": - version "10.36.2" + version "10.37.1" "@auto-it/core@link:packages/core": - version "10.36.2" + version "10.37.1" dependencies: "@auto-it/bot-list" "link:packages/bot-list" "@endemolshinegroup/cosmiconfig-typescript-loader" "^3.0.2" @@ -59,7 +59,7 @@ url-join "^4.0.0" "@auto-it/npm@link:plugins/npm": - version "10.36.2" + version "10.37.1" dependencies: "@auto-it/core" "link:packages/core" "@auto-it/package-json-utils" "link:packages/package-json-utils" @@ -77,13 +77,13 @@ user-home "^2.0.0" "@auto-it/package-json-utils@link:packages/package-json-utils": - version "10.36.2" + version "10.37.1" dependencies: parse-author "^2.0.0" parse-github-url "1.0.2" "@auto-it/released@link:plugins/released": - version "10.36.2" + version "10.37.1" dependencies: "@auto-it/bot-list" "link:packages/bot-list" "@auto-it/core" "link:packages/core" @@ -92,6 +92,15 @@ io-ts "^2.1.2" tslib "2.1.0" +"@auto-it/version-file@link:plugins/version-file": + version "10.37.1" + dependencies: + "@auto-it/core" "link:packages/core" + fp-ts "^2.5.3" + io-ts "^2.1.2" + semver "^7.0.0" + tslib "1.10.0" + "@babel/code-frame@7.12.11": version "7.12.11" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f" @@ -11531,12 +11540,7 @@ path-key@^3.0.0, path-key@^3.1.0: resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== -path-parse@^1.0.5, path-parse@^1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" - integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== - -path-parse@^1.0.7: +path-parse@^1.0.5, path-parse@^1.0.6, path-parse@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==