release-please 13.3.1 → 13.4.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,45 @@
4
4
 
5
5
  [1]: https://www.npmjs.com/package/release-please?activeTab=versions
6
6
 
7
+ ### [13.4.2](https://github.com/googleapis/release-please/compare/v13.4.1...v13.4.2) (2022-01-21)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * Manifest.fromFile no longer ignores manifestFile arg ([#1243](https://github.com/googleapis/release-please/issues/1243)) ([04a44ab](https://github.com/googleapis/release-please/commit/04a44ab08e8ce3911ad814744cebb79aab2ef8aa))
13
+
14
+ ### [13.4.1](https://github.com/googleapis/release-please/compare/v13.4.0...v13.4.1) (2022-01-20)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * handle windows newlines in pull request body ([#1239](https://github.com/googleapis/release-please/issues/1239)) ([69a424f](https://github.com/googleapis/release-please/commit/69a424ff2671ccfb661efd376aede155caee42ce))
20
+ * **python:** fix version regex to find multiple digit patch versions ([#1238](https://github.com/googleapis/release-please/issues/1238)) ([e03a3bf](https://github.com/googleapis/release-please/commit/e03a3bf81f0706b96bc76f217ab420a0f90b4152)), closes [#1237](https://github.com/googleapis/release-please/issues/1237)
21
+ * **python:** restore default changelog config for python ([#1240](https://github.com/googleapis/release-please/issues/1240)) ([54007ea](https://github.com/googleapis/release-please/commit/54007ea6d7d6c12f5757eeb2b5abdf13a8b524be))
22
+
23
+ ## [13.4.0](https://github.com/googleapis/release-please/compare/v13.3.2...v13.4.0) (2022-01-18)
24
+
25
+
26
+ ### Features
27
+
28
+ * add grouped manifest pr title pattern option ([#1184](https://github.com/googleapis/release-please/issues/1184)) ([df1332f](https://github.com/googleapis/release-please/commit/df1332f3b95e622752d351a29fc0a1b5083963c6))
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * **go-yoshi:** restore scope-based commit filtering ([#1233](https://github.com/googleapis/release-please/issues/1233)) ([597e6dd](https://github.com/googleapis/release-please/commit/597e6dd58217c62d562070032138cee8cad5e693))
34
+ * search for files on target branch, not default branch ([#1235](https://github.com/googleapis/release-please/issues/1235)) ([d891f00](https://github.com/googleapis/release-please/commit/d891f000eb2b198bfb4331b41bc5020fff52e1da))
35
+
36
+ ### [13.3.2](https://github.com/googleapis/release-please/compare/v13.3.1...v13.3.2) (2022-01-13)
37
+
38
+
39
+ ### Bug Fixes
40
+
41
+ * BranchName.parse should not throw exceptions ([#1227](https://github.com/googleapis/release-please/issues/1227)) ([364f1ac](https://github.com/googleapis/release-please/commit/364f1ac996b0120820d9bb37db96bb27a79aa936))
42
+ * 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))
43
+ * 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))
44
+ * 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))
45
+
7
46
  ### [13.3.1](https://github.com/googleapis/release-please/compare/v13.3.0...v13.3.1) (2022-01-12)
8
47
 
9
48
 
@@ -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
  });
@@ -71,6 +71,7 @@ export interface ManifestOptions {
71
71
  draft?: boolean;
72
72
  prerelease?: boolean;
73
73
  draftPullRequest?: boolean;
74
+ groupPullRequestTitlePattern?: string;
74
75
  }
75
76
  interface ReleaserPackageConfig extends ReleaserConfigJson {
76
77
  'package-name'?: string;
@@ -88,6 +89,7 @@ export interface ManifestConfig extends ReleaserConfigJson {
88
89
  'always-link-local'?: boolean;
89
90
  plugins?: PluginType[];
90
91
  'separate-pull-requests'?: boolean;
92
+ 'group-pull-request-title-pattern'?: string;
91
93
  }
92
94
  export declare type ReleasedVersions = Record<string, Version>;
93
95
  export declare type RepositoryConfig = Record<string, ReleaserConfig>;
@@ -122,6 +124,7 @@ export declare class Manifest {
122
124
  private draft?;
123
125
  private prerelease?;
124
126
  private draftPullRequest?;
127
+ private groupPullRequestTitlePattern?;
125
128
  /**
126
129
  * Create a Manifest from explicit config in code. This assumes that the
127
130
  * repository has a single component at the root path.
@@ -77,6 +77,7 @@ class Manifest {
77
77
  this.lastReleaseSha = manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.lastReleaseSha;
78
78
  this.draft = manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.draft;
79
79
  this.draftPullRequest = manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.draftPullRequest;
80
+ this.groupPullRequestTitlePattern = manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.groupPullRequestTitlePattern;
80
81
  }
81
82
  /**
82
83
  * Create a Manifest from config files in the repository.
@@ -92,7 +93,11 @@ class Manifest {
92
93
  parseConfig(github, configFile, targetBranch),
93
94
  parseReleasedVersions(github, manifestFile, targetBranch),
94
95
  ]);
95
- return new Manifest(github, targetBranch, repositoryConfig, releasedVersions, { ...manifestOptions, ...manifestOptionOverrides });
96
+ return new Manifest(github, targetBranch, repositoryConfig, releasedVersions, {
97
+ manifestPath: manifestFile,
98
+ ...manifestOptions,
99
+ ...manifestOptionOverrides,
100
+ });
96
101
  }
97
102
  /**
98
103
  * Create a Manifest from explicit config in code. This assumes that the
@@ -314,7 +319,7 @@ class Manifest {
314
319
  // Combine pull requests into 1 unless configured for separate
315
320
  // pull requests
316
321
  if (!this.separatePullRequests) {
317
- plugins.push(new merge_1.Merge(this.github, this.targetBranch, this.repositoryConfig));
322
+ plugins.push(new merge_1.Merge(this.github, this.targetBranch, this.repositoryConfig, this.groupPullRequestTitlePattern));
318
323
  }
319
324
  for (const plugin of plugins) {
320
325
  newReleasePullRequests = await plugin.run(newReleasePullRequests);
@@ -588,6 +593,7 @@ async function parseConfig(github, configFile, branch) {
588
593
  lastReleaseSha: config['last-release-sha'],
589
594
  alwaysLinkLocal: config['always-link-local'],
590
595
  separatePullRequests: config['separate-pull-requests'],
596
+ groupPullRequestTitlePattern: config['group-pull-request-title-pattern'],
591
597
  plugins: config['plugins'],
592
598
  };
593
599
  return { config: repositoryConfig, options: manifestOptions };
@@ -701,7 +707,7 @@ async function latestReleaseVersion(github, targetBranch, prefix, pullRequestTit
701
707
  return candidateTagVersion.sort((a, b) => b.compare(a))[0];
702
708
  }
703
709
  function mergeReleaserConfig(defaultConfig, pathConfig) {
704
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
710
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
705
711
  return {
706
712
  releaseType: (_b = (_a = pathConfig.releaseType) !== null && _a !== void 0 ? _a : defaultConfig.releaseType) !== null && _b !== void 0 ? _b : 'node',
707
713
  bumpMinorPreMajor: (_c = pathConfig.bumpMinorPreMajor) !== null && _c !== void 0 ? _c : defaultConfig.bumpMinorPreMajor,
@@ -716,6 +722,7 @@ function mergeReleaserConfig(defaultConfig, pathConfig) {
716
722
  packageName: (_m = pathConfig.packageName) !== null && _m !== void 0 ? _m : defaultConfig.packageName,
717
723
  versionFile: (_o = pathConfig.versionFile) !== null && _o !== void 0 ? _o : defaultConfig.versionFile,
718
724
  extraFiles: (_p = pathConfig.extraFiles) !== null && _p !== void 0 ? _p : defaultConfig.extraFiles,
725
+ pullRequestTitlePattern: (_q = pathConfig.pullRequestTitlePattern) !== null && _q !== void 0 ? _q : defaultConfig.pullRequestTitlePattern,
719
726
  };
720
727
  }
721
728
  /**
@@ -1,5 +1,6 @@
1
1
  import { ManifestPlugin } from '../plugin';
2
- import { CandidateReleasePullRequest } from '../manifest';
2
+ import { CandidateReleasePullRequest, RepositoryConfig } from '../manifest';
3
+ import { GitHub } from '../github';
3
4
  /**
4
5
  * This plugin merges multiple pull requests into a single
5
6
  * release pull request.
@@ -7,5 +8,7 @@ import { CandidateReleasePullRequest } from '../manifest';
7
8
  * Release notes are broken up using `<summary>`/`<details>` blocks.
8
9
  */
9
10
  export declare class Merge extends ManifestPlugin {
11
+ private pullRequestTitlePattern?;
12
+ constructor(github: GitHub, targetBranch: string, repositoryConfig: RepositoryConfig, pullRequestTitlePattern?: string);
10
13
  run(candidates: CandidateReleasePullRequest[]): Promise<CandidateReleasePullRequest[]>;
11
14
  }
@@ -27,6 +27,11 @@ const composite_1 = require("../updaters/composite");
27
27
  * Release notes are broken up using `<summary>`/`<details>` blocks.
28
28
  */
29
29
  class Merge extends plugin_1.ManifestPlugin {
30
+ constructor(github, targetBranch, repositoryConfig, pullRequestTitlePattern) {
31
+ super(github, targetBranch, repositoryConfig);
32
+ this.pullRequestTitlePattern =
33
+ pullRequestTitlePattern || manifest_1.MANIFEST_PULL_REQUEST_TITLE_PATTERN;
34
+ }
30
35
  async run(candidates) {
31
36
  if (candidates.length < 1) {
32
37
  return candidates;
@@ -34,6 +39,7 @@ class Merge extends plugin_1.ManifestPlugin {
34
39
  const releaseData = [];
35
40
  const labels = new Set();
36
41
  let rawUpdates = [];
42
+ let rootRelease = null;
37
43
  for (const candidate of candidates) {
38
44
  const pullRequest = candidate.pullRequest;
39
45
  rawUpdates = rawUpdates.concat(...pullRequest.updates);
@@ -41,10 +47,13 @@ class Merge extends plugin_1.ManifestPlugin {
41
47
  labels.add(label);
42
48
  }
43
49
  releaseData.push(...pullRequest.body.releaseData);
50
+ if (candidate.path === '.') {
51
+ rootRelease = candidate;
52
+ }
44
53
  }
45
54
  const updates = composite_1.mergeUpdates(rawUpdates);
46
55
  const pullRequest = {
47
- title: pull_request_title_1.PullRequestTitle.ofTargetBranch(this.targetBranch, manifest_1.MANIFEST_PULL_REQUEST_TITLE_PATTERN),
56
+ title: pull_request_title_1.PullRequestTitle.ofComponentTargetBranchVersion(rootRelease === null || rootRelease === void 0 ? void 0 : rootRelease.pullRequest.title.component, this.targetBranch, rootRelease === null || rootRelease === void 0 ? void 0 : rootRelease.pullRequest.title.version, this.pullRequestTitlePattern),
48
57
  body: new pull_request_body_1.PullRequestBody(releaseData),
49
58
  updates,
50
59
  labels: Array.from(labels),
@@ -55,7 +55,7 @@ export declare abstract class BaseStrategy implements Strategy {
55
55
  protected tagSeparator?: string;
56
56
  private skipGitHubRelease;
57
57
  private releaseAs?;
58
- private includeComponentInTag;
58
+ protected includeComponentInTag: boolean;
59
59
  private pullRequestTitlePattern?;
60
60
  readonly extraFiles: string[];
61
61
  readonly changelogNotes: ChangelogNotes;
@@ -79,7 +79,7 @@ export declare abstract class BaseStrategy implements Strategy {
79
79
  * @param {ConventionalCommit[]} commits parsed commits
80
80
  * @returns {ConventionalCommit[]} modified commits
81
81
  */
82
- protected postProcessCommits(commits: ConventionalCommit[]): ConventionalCommit[];
82
+ protected postProcessCommits(commits: ConventionalCommit[]): Promise<ConventionalCommit[]>;
83
83
  protected buildReleaseNotes(conventionalCommits: ConventionalCommit[], newVersion: Version, newVersionTag: TagName, latestRelease?: Release): Promise<string>;
84
84
  protected buildPullRequestBody(component: string | undefined, newVersion: Version, releaseNotesBody: string, _conventionalCommits: ConventionalCommit[], _latestRelease?: Release): Promise<PullRequestBody>;
85
85
  /**
@@ -81,7 +81,7 @@ class BaseStrategy {
81
81
  * @param {ConventionalCommit[]} commits parsed commits
82
82
  * @returns {ConventionalCommit[]} modified commits
83
83
  */
84
- postProcessCommits(commits) {
84
+ async postProcessCommits(commits) {
85
85
  return commits;
86
86
  }
87
87
  async buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease) {
@@ -117,13 +117,14 @@ class BaseStrategy {
117
117
  * open a pull request.
118
118
  */
119
119
  async buildReleasePullRequest(commits, latestRelease, draft, labels = []) {
120
- const conventionalCommits = this.postProcessCommits(commit_1.parseConventionalCommits(commits));
120
+ const conventionalCommits = await this.postProcessCommits(commit_1.parseConventionalCommits(commits));
121
+ logger_1.logger.info(`Considering: ${conventionalCommits.length} commits`);
121
122
  const newVersion = await this.buildNewVersion(conventionalCommits, latestRelease);
122
123
  const versionsMap = await this.updateVersionsMap(await this.buildVersionsMap(conventionalCommits), conventionalCommits);
123
124
  const component = await this.getComponent();
124
125
  logger_1.logger.debug('component:', component);
125
126
  const newVersionTag = new tag_name_1.TagName(newVersion, this.includeComponentInTag ? component : undefined, this.tagSeparator);
126
- logger_1.logger.warn('pull request title pattern:', this.pullRequestTitlePattern);
127
+ logger_1.logger.debug('pull request title pattern:', this.pullRequestTitlePattern);
127
128
  const pullRequestTitle = pull_request_title_1.PullRequestTitle.ofComponentTargetBranchVersion(component || '', this.targetBranch, newVersion, this.pullRequestTitlePattern);
128
129
  const branchName = component
129
130
  ? branch_name_1.BranchName.ofComponentTargetBranch(component, this.targetBranch)
@@ -181,12 +182,17 @@ class BaseStrategy {
181
182
  logger_1.logger.warn(`Setting version for ${this.path} from release-as configuration`);
182
183
  return version_1.Version.parse(this.releaseAs);
183
184
  }
184
- else if (latestRelease) {
185
- return await this.versioningStrategy.bump(latestRelease.tag.version, conventionalCommits);
185
+ const releaseAsCommit = conventionalCommits.find(conventionalCommit => conventionalCommit.notes.find(note => note.title === 'RELEASE AS'));
186
+ if (releaseAsCommit) {
187
+ const note = releaseAsCommit.notes.find(note => note.title === 'RELEASE AS');
188
+ if (note) {
189
+ return version_1.Version.parse(note.text);
190
+ }
186
191
  }
187
- else {
188
- return this.initialReleaseVersion();
192
+ if (latestRelease) {
193
+ return await this.versioningStrategy.bump(latestRelease.tag.version, conventionalCommits);
189
194
  }
195
+ return this.initialReleaseVersion();
190
196
  }
191
197
  async buildVersionsMap(_conventionalCommits) {
192
198
  return new Map();
@@ -7,7 +7,7 @@ import { Release } from '../release';
7
7
  export declare class GoYoshi extends BaseStrategy {
8
8
  constructor(options: BaseStrategyOptions);
9
9
  protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
10
- protected postProcessCommits(commits: ConventionalCommit[]): ConventionalCommit[];
10
+ protected postProcessCommits(commits: ConventionalCommit[]): Promise<ConventionalCommit[]>;
11
11
  protected buildReleaseNotes(conventionalCommits: ConventionalCommit[], newVersion: Version, newVersionTag: TagName, latestRelease?: Release): Promise<string>;
12
12
  protected initialReleaseVersion(): Version;
13
13
  }
@@ -18,6 +18,7 @@ const base_1 = require("./base");
18
18
  const changelog_1 = require("../updaters/changelog");
19
19
  const version_1 = require("../version");
20
20
  const version_go_1 = require("../updaters/go/version-go");
21
+ const logger_1 = require("../util/logger");
21
22
  // Commits containing a scope prefixed with an item in this array will be
22
23
  // ignored when generating a release PR for the parent module.
23
24
  const IGNORED_SUB_MODULES = new Set([
@@ -59,8 +60,10 @@ class GoYoshi extends base_1.BaseStrategy {
59
60
  });
60
61
  return updates;
61
62
  }
62
- postProcessCommits(commits) {
63
+ async postProcessCommits(commits) {
63
64
  let regenCommit;
65
+ const component = await this.getComponent();
66
+ logger_1.logger.debug('Filtering commits');
64
67
  return commits.filter(commit => {
65
68
  var _a, _b;
66
69
  // ignore commits whose scope is in the list of ignored modules
@@ -97,6 +100,37 @@ class GoYoshi extends base_1.BaseStrategy {
97
100
  }
98
101
  }
99
102
  }
103
+ // For google-cloud-go, filter into 2 cases, a subset of modules
104
+ // released independently, and the remainder
105
+ if (this.repository.owner === 'googleapis' &&
106
+ this.repository.repo === 'google-cloud-go') {
107
+ // Skip commits that don't have a scope as we don't know where to
108
+ // put them
109
+ if (!commit.scope) {
110
+ logger_1.logger.debug(`Skipping commit without scope: ${commit.message}`);
111
+ return false;
112
+ }
113
+ // Skip commits related to sub-modules as they are not part of
114
+ // the parent module.
115
+ if (this.includeComponentInTag) {
116
+ // This is a submodule release, so only include commits in this
117
+ // scope
118
+ if (!commitMatchesScope(commit.scope, component)) {
119
+ logger_1.logger.debug(`Skipping commit scope: ${commit.scope} != ${component}`);
120
+ return false;
121
+ }
122
+ }
123
+ else {
124
+ // This is the main module release, so ignore sub modules that
125
+ // are released independently
126
+ for (const submodule of IGNORED_SUB_MODULES) {
127
+ if (commitMatchesScope(commit.scope, submodule)) {
128
+ logger_1.logger.debug(`Skipping ignored commit scope: ${commit.scope}`);
129
+ return false;
130
+ }
131
+ }
132
+ }
133
+ }
100
134
  return true;
101
135
  });
102
136
  }
@@ -111,4 +145,7 @@ class GoYoshi extends base_1.BaseStrategy {
111
145
  }
112
146
  }
113
147
  exports.GoYoshi = GoYoshi;
148
+ function commitMatchesScope(commitScope, scope) {
149
+ return commitScope === scope || commitScope.startsWith(`${scope}/`);
150
+ }
114
151
  //# sourceMappingURL=go-yoshi.js.map
@@ -136,9 +136,9 @@ class JavaYoshi extends base_1.BaseStrategy {
136
136
  versionsMap,
137
137
  }),
138
138
  });
139
- const pomFilesSearch = this.github.findFilesByFilename('pom.xml', this.path);
140
- const buildFilesSearch = this.github.findFilesByFilename('build.gradle', this.path);
141
- const dependenciesSearch = this.github.findFilesByFilename('dependencies.properties', this.path);
139
+ const pomFilesSearch = this.github.findFilesByFilenameAndRef('pom.xml', this.targetBranch, this.path);
140
+ const buildFilesSearch = this.github.findFilesByFilenameAndRef('build.gradle', this.targetBranch, this.path);
141
+ const dependenciesSearch = this.github.findFilesByFilenameAndRef('dependencies.properties', this.targetBranch, this.path);
142
142
  const pomFiles = await pomFilesSearch;
143
143
  pomFiles.forEach(path => {
144
144
  updates.push({
@@ -50,7 +50,7 @@ class PHPYoshi extends base_1.BaseStrategy {
50
50
  }
51
51
  async buildReleasePullRequest(commits, latestRelease, draft, labels = []) {
52
52
  var _a, _b, _c;
53
- const conventionalCommits = this.postProcessCommits(commit_1.parseConventionalCommits(commits));
53
+ const conventionalCommits = await this.postProcessCommits(commit_1.parseConventionalCommits(commits));
54
54
  const newVersion = latestRelease
55
55
  ? await this.versioningStrategy.bump(latestRelease.tag.version, conventionalCommits)
56
56
  : this.initialReleaseVersion();
@@ -1,7 +1,8 @@
1
- import { BaseStrategy, BuildUpdatesOptions } from './base';
1
+ import { BaseStrategy, BuildUpdatesOptions, BaseStrategyOptions } from './base';
2
2
  import { Update } from '../update';
3
3
  import { Version } from '../version';
4
4
  export declare class Python extends BaseStrategy {
5
+ constructor(options: BaseStrategyOptions);
5
6
  protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
6
7
  private getPyProject;
7
8
  protected initialReleaseVersion(): Version;
@@ -22,7 +22,26 @@ const setup_py_1 = require("../updaters/python/setup-py");
22
22
  const pyproject_toml_1 = require("../updaters/python/pyproject-toml");
23
23
  const logger_1 = require("../util/logger");
24
24
  const python_file_with_version_1 = require("../updaters/python/python-file-with-version");
25
+ const CHANGELOG_SECTIONS = [
26
+ { type: 'feat', section: 'Features' },
27
+ { type: 'fix', section: 'Bug Fixes' },
28
+ { type: 'perf', section: 'Performance Improvements' },
29
+ { type: 'deps', section: 'Dependencies' },
30
+ { type: 'revert', section: 'Reverts' },
31
+ { type: 'docs', section: 'Documentation' },
32
+ { type: 'style', section: 'Styles', hidden: true },
33
+ { type: 'chore', section: 'Miscellaneous Chores', hidden: true },
34
+ { type: 'refactor', section: 'Code Refactoring', hidden: true },
35
+ { type: 'test', section: 'Tests', hidden: true },
36
+ { type: 'build', section: 'Build System', hidden: true },
37
+ { type: 'ci', section: 'Continuous Integration', hidden: true },
38
+ ];
25
39
  class Python extends base_1.BaseStrategy {
40
+ constructor(options) {
41
+ var _a;
42
+ options.changelogSections = (_a = options.changelogSections) !== null && _a !== void 0 ? _a : CHANGELOG_SECTIONS;
43
+ super(options);
44
+ }
26
45
  async buildUpdates(options) {
27
46
  var _a;
28
47
  const updates = [];
@@ -87,7 +106,7 @@ class Python extends base_1.BaseStrategy {
87
106
  });
88
107
  }
89
108
  // There should be only one version.py, but foreach in case that is incorrect
90
- const versionPyFilesSearch = this.github.findFilesByFilename('version.py', this.path);
109
+ const versionPyFilesSearch = this.github.findFilesByFilenameAndRef('version.py', this.targetBranch, this.path);
91
110
  const versionPyFiles = await versionPyFilesSearch;
92
111
  versionPyFiles.forEach(path => {
93
112
  updates.push({
@@ -11,7 +11,7 @@ export declare class RubyYoshi extends BaseStrategy {
11
11
  readonly versionFile: string;
12
12
  constructor(options: RubyYoshiStrategyOptions);
13
13
  protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
14
- protected postProcessCommits(commits: ConventionalCommit[]): ConventionalCommit[];
14
+ protected postProcessCommits(commits: ConventionalCommit[]): Promise<ConventionalCommit[]>;
15
15
  protected buildPullRequestBody(component: string | undefined, newVersion: Version, releaseNotesBody: string, conventionalCommits: ConventionalCommit[], latestRelease?: Release): Promise<PullRequestBody>;
16
16
  }
17
17
  export {};
@@ -74,7 +74,7 @@ class RubyYoshi extends base_1.BaseStrategy {
74
74
  });
75
75
  return updates;
76
76
  }
77
- postProcessCommits(commits) {
77
+ async postProcessCommits(commits) {
78
78
  commits.forEach(commit => {
79
79
  commit.message = indent_commit_1.indentCommit(commit);
80
80
  });
@@ -8,6 +8,6 @@ export declare class Ruby extends BaseStrategy {
8
8
  readonly versionFile: string;
9
9
  constructor(options: RubyStrategyOptions);
10
10
  protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
11
- protected postProcessCommits(commits: ConventionalCommit[]): ConventionalCommit[];
11
+ protected postProcessCommits(commits: ConventionalCommit[]): Promise<ConventionalCommit[]>;
12
12
  }
13
13
  export {};
@@ -50,7 +50,7 @@ class Ruby extends base_1.BaseStrategy {
50
50
  });
51
51
  return updates;
52
52
  }
53
- postProcessCommits(commits) {
53
+ async postProcessCommits(commits) {
54
54
  commits.forEach(commit => {
55
55
  commit.message = indent_commit_1.indentCommit(commit);
56
56
  });
@@ -35,7 +35,7 @@ class TerraformModule extends base_1.BaseStrategy {
35
35
  });
36
36
  // Update version in README to current candidate version.
37
37
  // A module may have submodules, so find all submodules.
38
- const readmeFiles = await this.github.findFilesByFilename('readme.md', this.path);
38
+ const readmeFiles = await this.github.findFilesByFilenameAndRef('readme.md', this.targetBranch, this.path);
39
39
  readmeFiles.forEach(path => {
40
40
  updates.push({
41
41
  path: this.addPath(path),
@@ -48,8 +48,8 @@ class TerraformModule extends base_1.BaseStrategy {
48
48
  // Update versions.tf to current candidate version.
49
49
  // A module may have submodules, so find all versions.tfand versions.tf.tmpl to update.
50
50
  const versionFiles = await Promise.all([
51
- this.github.findFilesByFilename('versions.tf', this.path),
52
- this.github.findFilesByFilename('versions.tf.tmpl', this.path),
51
+ this.github.findFilesByFilenameAndRef('versions.tf', this.targetBranch, this.path),
52
+ this.github.findFilesByFilenameAndRef('versions.tf.tmpl', this.targetBranch, this.path),
53
53
  ]).then(([v, vt]) => {
54
54
  return v.concat(vt);
55
55
  });
@@ -25,7 +25,7 @@ class SetupPy extends default_1.DefaultUpdater {
25
25
  * @returns {string} The updated content
26
26
  */
27
27
  updateContent(content) {
28
- return content.replace(/(version ?= ?["'])[0-9]+\.[0-9]+\.[0-9](?:-\w+)?(["'])/, `$1${this.version}$2`);
28
+ return content.replace(/(version ?= ?["'])[0-9]+\.[0-9]+\.[0-9]+(?:-\w+)?(["'])/, `$1${this.version}$2`);
29
29
  }
30
30
  }
31
31
  exports.SetupPy = SetupPy;
@@ -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}`);
@@ -70,7 +70,7 @@ ${this.footer}`;
70
70
  }
71
71
  exports.PullRequestBody = PullRequestBody;
72
72
  function splitBody(body) {
73
- const lines = body.trim().split('\n');
73
+ const lines = body.trim().replace(/\r\n/g, '\n').split('\n');
74
74
  const index = lines.indexOf(NOTES_DELIMITER);
75
75
  if (index === -1) {
76
76
  return undefined;
@@ -11,7 +11,7 @@ export declare class PullRequestTitle {
11
11
  static ofComponentVersion(component: string, version: Version, pullRequestTitlePattern?: string): PullRequestTitle;
12
12
  static ofVersion(version: Version, pullRequestTitlePattern?: string): PullRequestTitle;
13
13
  static ofTargetBranchVersion(targetBranch: string, version: Version, pullRequestTitlePattern?: string): PullRequestTitle;
14
- static ofComponentTargetBranchVersion(component: string, targetBranch: string, version: Version, pullRequestTitlePattern?: string): PullRequestTitle;
14
+ static ofComponentTargetBranchVersion(component?: string, targetBranch?: string, version?: Version, pullRequestTitlePattern?: string): PullRequestTitle;
15
15
  static ofTargetBranch(targetBranch: string, pullRequestTitlePattern?: string): PullRequestTitle;
16
16
  getTargetBranch(): string | undefined;
17
17
  getComponent(): string | undefined;
@@ -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.4.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",
@@ -79,7 +79,7 @@
79
79
  "node-html-parser": "^5.0.0",
80
80
  "parse-github-repo-url": "^1.4.1",
81
81
  "semver": "^7.0.0",
82
- "type-fest": "^1.0.0",
82
+ "type-fest": "^2.0.0",
83
83
  "typescript": "^3.8.3",
84
84
  "unist-util-visit": "^2.0.3",
85
85
  "unist-util-visit-parents": "^3.1.1",