fix(dev-infra): use the version from package.json rather than tags (#42872)

Use the version value from the primary package.json file rather than
checking the branch for the latest semver tag.  This allows for us
to explictly create changelogs from the previous version to the new
version.

PR Close #42872
This commit is contained in:
Joey Perrott
2021-07-15 17:06:15 -07:00
committed by Alex Rickabaugh
parent 445fee4174
commit 282e86ad71
6 changed files with 70 additions and 4 deletions
+13
View File
@@ -162,6 +162,19 @@ export class GitClient {
return new SemVer(latestTag, semVerOptions);
}
/** Retrieves the git tag matching the provided SemVer, if it exists. */
getMatchingTagForSemver(semver: SemVer): string {
const semVerOptions: SemVerOptions = {loose: true};
const tags = this.runGraceful(['tag', '--sort=-committerdate', '--merged']).stdout.split('\n');
const matchingTag =
tags.find((tag: string) => parse(tag, semVerOptions)?.compare(semver) === 0);
if (matchingTag === undefined) {
throw new Error(`Unable to find a tag for the version: "${semver.format()}"`);
}
return matchingTag;
}
/** Retrieve a list of all files in the repository changed since the provided shaOrRef. */
allChangesFilesSince(shaOrRef = 'HEAD'): string[] {
return Array.from(new Set([