release-please 13.3.1 → 13.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,16 @@
4
4
 
5
5
  [1]: https://www.npmjs.com/package/release-please?activeTab=versions
6
6
 
7
+ ### [13.3.2](https://github.com/googleapis/release-please/compare/v13.3.1...v13.3.2) (2022-01-13)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * BranchName.parse should not throw exceptions ([#1227](https://github.com/googleapis/release-please/issues/1227)) ([364f1ac](https://github.com/googleapis/release-please/commit/364f1ac996b0120820d9bb37db96bb27a79aa936))
13
+ * initial release version should respect Release-As commit ([#1222](https://github.com/googleapis/release-please/issues/1222)) ([22b9770](https://github.com/googleapis/release-please/commit/22b977028e2959aea088c09e3a021e2aa0e10f03))
14
+ * Release-As commits should appear in the changelog correctly ([#1220](https://github.com/googleapis/release-please/issues/1220)) ([ab56c82](https://github.com/googleapis/release-please/commit/ab56c82e81091cbedeb8f328451ac486d7f986a4))
15
+ * use latest Release-As commit when overriding version ([#1224](https://github.com/googleapis/release-please/issues/1224)) ([2d7cb8f](https://github.com/googleapis/release-please/commit/2d7cb8fa329d1c60b881bc0435523b81ea47a32d))
16
+
7
17
  ### [13.3.1](https://github.com/googleapis/release-please/compare/v13.3.0...v13.3.1) (2022-01-12)
8
18
 
9
19
 
@@ -52,13 +52,16 @@ class DefaultChangelogNotes {
52
52
  subject: commit.bareMessage,
53
53
  type: commit.type,
54
54
  scope: commit.scope,
55
- notes: commit.notes,
55
+ notes: commit.notes.filter(note => note.title === 'BREAKING CHANGE'),
56
56
  references: commit.references,
57
57
  mentions: [],
58
58
  merge: null,
59
59
  revert: null,
60
60
  header: commit.message,
61
- footer: null,
61
+ footer: commit.notes
62
+ .filter(note => note.title === 'RELEASE AS')
63
+ .map(note => `Release-As: ${note.text}`)
64
+ .join('\n'),
62
65
  hash: commit.sha,
63
66
  };
64
67
  });
@@ -181,12 +181,17 @@ class BaseStrategy {
181
181
  logger_1.logger.warn(`Setting version for ${this.path} from release-as configuration`);
182
182
  return version_1.Version.parse(this.releaseAs);
183
183
  }
184
- else if (latestRelease) {
185
- return await this.versioningStrategy.bump(latestRelease.tag.version, conventionalCommits);
184
+ const releaseAsCommit = conventionalCommits.find(conventionalCommit => conventionalCommit.notes.find(note => note.title === 'RELEASE AS'));
185
+ if (releaseAsCommit) {
186
+ const note = releaseAsCommit.notes.find(note => note.title === 'RELEASE AS');
187
+ if (note) {
188
+ return version_1.Version.parse(note.text);
189
+ }
186
190
  }
187
- else {
188
- return this.initialReleaseVersion();
191
+ if (latestRelease) {
192
+ return await this.versioningStrategy.bump(latestRelease.tag.version, conventionalCommits);
189
193
  }
194
+ return this.initialReleaseVersion();
190
195
  }
191
196
  async buildVersionsMap(_conventionalCommits) {
192
197
  return new Map();
@@ -15,6 +15,7 @@
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.BranchName = void 0;
17
17
  const version_1 = require("../version");
18
+ const logger_1 = require("./logger");
18
19
  // cannot import from '..' - transpiled code references to RELEASE_PLEASE
19
20
  // at the script level are undefined, they are only defined inside function
20
21
  // or instance methods/properties.
@@ -32,13 +33,19 @@ function getAllResourceNames() {
32
33
  class BranchName {
33
34
  constructor(_branchName) { }
34
35
  static parse(branchName) {
35
- const branchNameClass = getAllResourceNames().find(clazz => {
36
- return clazz.matches(branchName);
37
- });
38
- if (!branchNameClass) {
36
+ try {
37
+ const branchNameClass = getAllResourceNames().find(clazz => {
38
+ return clazz.matches(branchName);
39
+ });
40
+ if (!branchNameClass) {
41
+ return undefined;
42
+ }
43
+ return new branchNameClass(branchName);
44
+ }
45
+ catch (e) {
46
+ logger_1.logger.warn(`Error parsing branch name: ${branchName}`, e);
39
47
  return undefined;
40
48
  }
41
- return new branchNameClass(branchName);
42
49
  }
43
50
  static ofComponentVersion(branchPrefix, version) {
44
51
  return new AutoreleaseBranchName(`release-${branchPrefix}-v${version}`);
@@ -16,6 +16,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.DefaultVersioningStrategy = void 0;
17
17
  const versioning_strategy_1 = require("../versioning-strategy");
18
18
  const version_1 = require("../version");
19
+ const logger_1 = require("../util/logger");
19
20
  /**
20
21
  * This is the default VersioningStrategy for release-please. Breaking
21
22
  * changes should bump the major, features should bump the minor, and other
@@ -48,11 +49,12 @@ class DefaultVersioningStrategy {
48
49
  // iterate through list of commits and find biggest commit type
49
50
  let breaking = 0;
50
51
  let features = 0;
51
- let customVersion;
52
52
  for (const commit of commits) {
53
53
  const releaseAs = commit.notes.find(note => note.title === 'RELEASE AS');
54
54
  if (releaseAs) {
55
- customVersion = version_1.Version.parse(releaseAs.text);
55
+ // commits are handled newest to oldest, so take the first one (newest) found
56
+ logger_1.logger.debug(`found Release-As: ${releaseAs.text}, forcing version`);
57
+ return new versioning_strategy_1.CustomVersionUpdate(version_1.Version.parse(releaseAs.text).toString());
56
58
  }
57
59
  if (commit.breaking) {
58
60
  breaking++;
@@ -61,9 +63,6 @@ class DefaultVersioningStrategy {
61
63
  features++;
62
64
  }
63
65
  }
64
- if (customVersion) {
65
- return new versioning_strategy_1.CustomVersionUpdate(customVersion.toString());
66
- }
67
66
  if (breaking > 0) {
68
67
  if (version.major < 1 && this.bumpMinorPreMajor) {
69
68
  return new versioning_strategy_1.MinorVersionUpdate();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-please",
3
- "version": "13.3.1",
3
+ "version": "13.3.2",
4
4
  "description": "generate release PRs based on the conventionalcommits.org spec",
5
5
  "main": "./build/src/index.js",
6
6
  "bin": "./build/src/bin/release-please.js",