release-please 16.0.0 → 16.2.0

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,32 @@
4
4
 
5
5
  [1]: https://www.npmjs.com/package/release-please?activeTab=versions
6
6
 
7
+ ## [16.2.0](https://github.com/googleapis/release-please/compare/v16.1.0...v16.2.0) (2023-11-08)
8
+
9
+
10
+ ### Features
11
+
12
+ * Allow customizing PR body footer ([#2115](https://github.com/googleapis/release-please/issues/2115)) ([43014a1](https://github.com/googleapis/release-please/commit/43014a1f15d3640d67cb90cbf3047919facfa53e))
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * Correctly parse standalone prerelease PR body ([#2123](https://github.com/googleapis/release-please/issues/2123)) ([5ee9e3e](https://github.com/googleapis/release-please/commit/5ee9e3e9ae292dc4128717c3d5924da93b3bb670))
18
+ * Set PR labels serially ([#2122](https://github.com/googleapis/release-please/issues/2122)) ([bf58911](https://github.com/googleapis/release-please/commit/bf58911d989f08abe3105309b6e6f918186e1125))
19
+
20
+ ## [16.1.0](https://github.com/googleapis/release-please/compare/v16.0.0...v16.1.0) (2023-10-26)
21
+
22
+
23
+ ### Features
24
+
25
+ * Implement custom prerelease type ([#2083](https://github.com/googleapis/release-please/issues/2083)) ([97b0542](https://github.com/googleapis/release-please/commit/97b05421168316a23592897c8853893adf08d24c))
26
+ * Update package-lock.json workspace entry versions ([#2088](https://github.com/googleapis/release-please/issues/2088)) ([dbb11bc](https://github.com/googleapis/release-please/commit/dbb11bc62d6c8135b5b168354e8f235398ffab03)), closes [#1993](https://github.com/googleapis/release-please/issues/1993)
27
+
28
+
29
+ ### Bug Fixes
30
+
31
+ * Releasable units should use version from pull-request body ([#2102](https://github.com/googleapis/release-please/issues/2102)) ([db035b7](https://github.com/googleapis/release-please/commit/db035b798f33c5ce0ddf2a43dcf2458c170c8fe3)), closes [#2101](https://github.com/googleapis/release-please/issues/2101)
32
+
7
33
  ## [16.0.0](https://github.com/googleapis/release-please/compare/v15.13.0...v16.0.0) (2023-09-18)
8
34
 
9
35
 
package/README.md CHANGED
@@ -63,7 +63,7 @@ A linear git history makes it much easier to:
63
63
  change introduced a bug
64
64
  * Control the release-please changelog - when you merge a PR, you may have
65
65
  commit messages that make sense within the scope of the PR, but don't
66
- make sense when merged in the main branch. For example, you make have
66
+ make sense when merged in the main branch. For example, you may have
67
67
  `feat: introduce feature A` and then `fix: some bugfix introduced in
68
68
  the first commit`. The `fix` commit is actually irrelevant to the release
69
69
  notes as there was never a bug experienced in the main branch.
@@ -190,7 +190,7 @@ Release Please automates releases for the following flavors of repositories:
190
190
  | `krm-blueprint` | [A kpt package, with 1 or more KRM files and a CHANGELOG.md](https://github.com/GoogleCloudPlatform/blueprints/tree/main/catalog/project) |
191
191
  | `maven` | [Strategy for Maven projects, generates SNAPSHOT version after each release and updates `pom.xml` automatically](docs/java.md) |
192
192
  | `node` | [A Node.js repository, with a package.json and CHANGELOG.md](https://github.com/yargs/yargs) |
193
- | `expo` | [An Expo based React Native repository, with a package.json, app.json and CHANGELOG.md](https://github.com/yargs/yargs) |
193
+ | `expo` | An Expo based React Native repository, with a package.json, app.json and CHANGELOG.md |
194
194
  | `ocaml` | [An OCaml repository, containing 1 or more opam or esy files and a CHANGELOG.md](https://github.com/grain-lang/binaryen.ml) |
195
195
  | `php` | A repository with a composer.json and a CHANGELOG.md |
196
196
  | `python` | [A Python repository, with a setup.py, setup.cfg, CHANGELOG.md](https://github.com/googleapis/python-storage) and optionally a pyproject.toml and a <project>/\_\_init\_\_.py |
@@ -142,6 +142,10 @@ function pullRequestStrategyOptions(yargs) {
142
142
  ' changes prior to the first major release',
143
143
  default: false,
144
144
  type: 'boolean',
145
+ })
146
+ .option('prerelease-type', {
147
+ describe: 'type of the prerelease, e.g., alpha',
148
+ type: 'string',
145
149
  })
146
150
  .option('extra-files', {
147
151
  describe: 'extra files for the strategy to consider',
@@ -270,6 +274,10 @@ function taggingOptions(yargs) {
270
274
  .option('pull-request-header', {
271
275
  describe: 'Header for release PR',
272
276
  type: 'string',
277
+ })
278
+ .option('pull-request-footer', {
279
+ describe: 'Footer for release PR',
280
+ type: 'string',
273
281
  });
274
282
  }
275
283
  const createReleasePullRequestCommand = {
@@ -290,11 +298,13 @@ const createReleasePullRequestCommand = {
290
298
  draftPullRequest: argv.draftPullRequest,
291
299
  bumpMinorPreMajor: argv.bumpMinorPreMajor,
292
300
  bumpPatchForMinorPreMajor: argv.bumpPatchForMinorPreMajor,
301
+ prereleaseType: argv.prereleaseType,
293
302
  changelogPath: argv.changelogPath,
294
303
  changelogType: argv.changelogType,
295
304
  changelogHost: argv.changelogHost,
296
305
  pullRequestTitlePattern: argv.pullRequestTitlePattern,
297
306
  pullRequestHeader: argv.pullRequestHeader,
307
+ pullRequestFooter: argv.pullRequestFooter,
298
308
  changelogSections: argv.changelogSections,
299
309
  releaseAs: argv.releaseAs,
300
310
  versioning: argv.versioningStrategy,
@@ -481,6 +491,7 @@ const bootstrapCommand = {
481
491
  draftPullRequest: argv.draftPullRequest,
482
492
  bumpMinorPreMajor: argv.bumpMinorPreMajor,
483
493
  bumpPatchForMinorPreMajor: argv.bumpPatchForMinorPreMajor,
494
+ prereleaseType: argv.prereleaseType,
484
495
  changelogPath: argv.changelogPath,
485
496
  changelogHost: argv.changelogHost,
486
497
  changelogSections: argv.changelogSections,
@@ -5,6 +5,7 @@ export interface VersioningStrategyFactoryOptions {
5
5
  type?: VersioningStrategyType;
6
6
  bumpMinorPreMajor?: boolean;
7
7
  bumpPatchForMinorPreMajor?: boolean;
8
+ prereleaseType?: string;
8
9
  github: GitHub;
9
10
  }
10
11
  export type VersioningStrategyBuilder = (options: VersioningStrategyFactoryOptions) => VersioningStrategy;
@@ -109,6 +109,7 @@ async function buildStrategy(options) {
109
109
  type: options.versioning,
110
110
  bumpMinorPreMajor: options.bumpMinorPreMajor,
111
111
  bumpPatchForMinorPreMajor: options.bumpPatchForMinorPreMajor,
112
+ prereleaseType: options.prereleaseType,
112
113
  });
113
114
  const changelogNotes = (0, changelog_notes_factory_1.buildChangelogNotes)({
114
115
  type: options.changelogType || 'default',
@@ -45,6 +45,7 @@ export interface ReleaserConfig {
45
45
  versioning?: VersioningStrategyType;
46
46
  bumpMinorPreMajor?: boolean;
47
47
  bumpPatchForMinorPreMajor?: boolean;
48
+ prereleaseType?: string;
48
49
  releaseAs?: string;
49
50
  skipGithubRelease?: boolean;
50
51
  draft?: boolean;
@@ -56,6 +57,7 @@ export interface ReleaserConfig {
56
57
  includeVInTag?: boolean;
57
58
  pullRequestTitlePattern?: string;
58
59
  pullRequestHeader?: string;
60
+ pullRequestFooter?: string;
59
61
  tagSeparator?: string;
60
62
  separatePullRequests?: boolean;
61
63
  labels?: string[];
@@ -88,6 +90,7 @@ interface ReleaserConfigJson {
88
90
  versioning?: VersioningStrategyType;
89
91
  'bump-minor-pre-major'?: boolean;
90
92
  'bump-patch-for-minor-pre-major'?: boolean;
93
+ 'prerelease-type'?: string;
91
94
  'changelog-sections'?: ChangelogSection[];
92
95
  'release-as'?: string;
93
96
  'skip-github-release'?: boolean;
@@ -103,6 +106,7 @@ interface ReleaserConfigJson {
103
106
  'changelog-host'?: string;
104
107
  'pull-request-title-pattern'?: string;
105
108
  'pull-request-header'?: string;
109
+ 'pull-request-footer'?: string;
106
110
  'separate-pull-requests'?: boolean;
107
111
  'tag-separator'?: string;
108
112
  'extra-files'?: ExtraFile[];
@@ -688,10 +688,8 @@ class Manifest {
688
688
  releases.length) {
689
689
  // we've either tagged all releases or they were duplicates:
690
690
  // adjust tags on pullRequest
691
- await Promise.all([
692
- this.github.removeIssueLabels(this.labels, pullRequest.number),
693
- this.github.addIssueLabels(this.releaseLabels, pullRequest.number),
694
- ]);
691
+ await this.github.removeIssueLabels(this.labels, pullRequest.number);
692
+ await this.github.addIssueLabels(this.releaseLabels, pullRequest.number);
695
693
  }
696
694
  if (githubReleases.length === 0) {
697
695
  // If all releases were duplicate, throw a duplicate error
@@ -700,10 +698,8 @@ class Manifest {
700
698
  }
701
699
  else {
702
700
  // adjust tags on pullRequest
703
- await Promise.all([
704
- this.github.removeIssueLabels(this.labels, pullRequest.number),
705
- this.github.addIssueLabels(this.releaseLabels, pullRequest.number),
706
- ]);
701
+ await this.github.removeIssueLabels(this.labels, pullRequest.number);
702
+ await this.github.addIssueLabels(this.releaseLabels, pullRequest.number);
707
703
  }
708
704
  return githubReleases;
709
705
  }
@@ -772,6 +768,7 @@ function extractReleaserConfig(config) {
772
768
  releaseType: config['release-type'],
773
769
  bumpMinorPreMajor: config['bump-minor-pre-major'],
774
770
  bumpPatchForMinorPreMajor: config['bump-patch-for-minor-pre-major'],
771
+ prereleaseType: config['prerelease-type'],
775
772
  versioning: config['versioning'],
776
773
  changelogSections: config['changelog-sections'],
777
774
  changelogPath: config['changelog-path'],
@@ -790,6 +787,7 @@ function extractReleaserConfig(config) {
790
787
  changelogType: config['changelog-type'],
791
788
  pullRequestTitlePattern: config['pull-request-title-pattern'],
792
789
  pullRequestHeader: config['pull-request-header'],
790
+ pullRequestFooter: config['pull-request-footer'],
793
791
  tagSeparator: config['tag-separator'],
794
792
  separatePullRequests: config['separate-pull-requests'],
795
793
  labels: (_a = config['label']) === null || _a === void 0 ? void 0 : _a.split(','),
@@ -1010,34 +1008,36 @@ async function latestReleaseVersion(github, targetBranch, releaseFilter, config,
1010
1008
  return candidateTagVersion.sort((a, b) => b.compare(a))[0];
1011
1009
  }
1012
1010
  function mergeReleaserConfig(defaultConfig, pathConfig) {
1013
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
1011
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
1014
1012
  return {
1015
1013
  releaseType: (_b = (_a = pathConfig.releaseType) !== null && _a !== void 0 ? _a : defaultConfig.releaseType) !== null && _b !== void 0 ? _b : 'node',
1016
1014
  bumpMinorPreMajor: (_c = pathConfig.bumpMinorPreMajor) !== null && _c !== void 0 ? _c : defaultConfig.bumpMinorPreMajor,
1017
1015
  bumpPatchForMinorPreMajor: (_d = pathConfig.bumpPatchForMinorPreMajor) !== null && _d !== void 0 ? _d : defaultConfig.bumpPatchForMinorPreMajor,
1018
- versioning: (_e = pathConfig.versioning) !== null && _e !== void 0 ? _e : defaultConfig.versioning,
1019
- changelogSections: (_f = pathConfig.changelogSections) !== null && _f !== void 0 ? _f : defaultConfig.changelogSections,
1020
- changelogPath: (_g = pathConfig.changelogPath) !== null && _g !== void 0 ? _g : defaultConfig.changelogPath,
1021
- changelogHost: (_h = pathConfig.changelogHost) !== null && _h !== void 0 ? _h : defaultConfig.changelogHost,
1022
- changelogType: (_j = pathConfig.changelogType) !== null && _j !== void 0 ? _j : defaultConfig.changelogType,
1023
- releaseAs: (_k = pathConfig.releaseAs) !== null && _k !== void 0 ? _k : defaultConfig.releaseAs,
1024
- skipGithubRelease: (_l = pathConfig.skipGithubRelease) !== null && _l !== void 0 ? _l : defaultConfig.skipGithubRelease,
1025
- draft: (_m = pathConfig.draft) !== null && _m !== void 0 ? _m : defaultConfig.draft,
1026
- prerelease: (_o = pathConfig.prerelease) !== null && _o !== void 0 ? _o : defaultConfig.prerelease,
1027
- component: (_p = pathConfig.component) !== null && _p !== void 0 ? _p : defaultConfig.component,
1028
- packageName: (_q = pathConfig.packageName) !== null && _q !== void 0 ? _q : defaultConfig.packageName,
1029
- versionFile: (_r = pathConfig.versionFile) !== null && _r !== void 0 ? _r : defaultConfig.versionFile,
1030
- extraFiles: (_s = pathConfig.extraFiles) !== null && _s !== void 0 ? _s : defaultConfig.extraFiles,
1031
- includeComponentInTag: (_t = pathConfig.includeComponentInTag) !== null && _t !== void 0 ? _t : defaultConfig.includeComponentInTag,
1032
- includeVInTag: (_u = pathConfig.includeVInTag) !== null && _u !== void 0 ? _u : defaultConfig.includeVInTag,
1033
- tagSeparator: (_v = pathConfig.tagSeparator) !== null && _v !== void 0 ? _v : defaultConfig.tagSeparator,
1034
- pullRequestTitlePattern: (_w = pathConfig.pullRequestTitlePattern) !== null && _w !== void 0 ? _w : defaultConfig.pullRequestTitlePattern,
1035
- pullRequestHeader: (_x = pathConfig.pullRequestHeader) !== null && _x !== void 0 ? _x : defaultConfig.pullRequestHeader,
1036
- separatePullRequests: (_y = pathConfig.separatePullRequests) !== null && _y !== void 0 ? _y : defaultConfig.separatePullRequests,
1037
- skipSnapshot: (_z = pathConfig.skipSnapshot) !== null && _z !== void 0 ? _z : defaultConfig.skipSnapshot,
1038
- initialVersion: (_0 = pathConfig.initialVersion) !== null && _0 !== void 0 ? _0 : defaultConfig.initialVersion,
1039
- extraLabels: (_1 = pathConfig.extraLabels) !== null && _1 !== void 0 ? _1 : defaultConfig.extraLabels,
1040
- excludePaths: (_2 = pathConfig.excludePaths) !== null && _2 !== void 0 ? _2 : defaultConfig.excludePaths,
1016
+ prereleaseType: (_e = pathConfig.prereleaseType) !== null && _e !== void 0 ? _e : defaultConfig.prereleaseType,
1017
+ versioning: (_f = pathConfig.versioning) !== null && _f !== void 0 ? _f : defaultConfig.versioning,
1018
+ changelogSections: (_g = pathConfig.changelogSections) !== null && _g !== void 0 ? _g : defaultConfig.changelogSections,
1019
+ changelogPath: (_h = pathConfig.changelogPath) !== null && _h !== void 0 ? _h : defaultConfig.changelogPath,
1020
+ changelogHost: (_j = pathConfig.changelogHost) !== null && _j !== void 0 ? _j : defaultConfig.changelogHost,
1021
+ changelogType: (_k = pathConfig.changelogType) !== null && _k !== void 0 ? _k : defaultConfig.changelogType,
1022
+ releaseAs: (_l = pathConfig.releaseAs) !== null && _l !== void 0 ? _l : defaultConfig.releaseAs,
1023
+ skipGithubRelease: (_m = pathConfig.skipGithubRelease) !== null && _m !== void 0 ? _m : defaultConfig.skipGithubRelease,
1024
+ draft: (_o = pathConfig.draft) !== null && _o !== void 0 ? _o : defaultConfig.draft,
1025
+ prerelease: (_p = pathConfig.prerelease) !== null && _p !== void 0 ? _p : defaultConfig.prerelease,
1026
+ component: (_q = pathConfig.component) !== null && _q !== void 0 ? _q : defaultConfig.component,
1027
+ packageName: (_r = pathConfig.packageName) !== null && _r !== void 0 ? _r : defaultConfig.packageName,
1028
+ versionFile: (_s = pathConfig.versionFile) !== null && _s !== void 0 ? _s : defaultConfig.versionFile,
1029
+ extraFiles: (_t = pathConfig.extraFiles) !== null && _t !== void 0 ? _t : defaultConfig.extraFiles,
1030
+ includeComponentInTag: (_u = pathConfig.includeComponentInTag) !== null && _u !== void 0 ? _u : defaultConfig.includeComponentInTag,
1031
+ includeVInTag: (_v = pathConfig.includeVInTag) !== null && _v !== void 0 ? _v : defaultConfig.includeVInTag,
1032
+ tagSeparator: (_w = pathConfig.tagSeparator) !== null && _w !== void 0 ? _w : defaultConfig.tagSeparator,
1033
+ pullRequestTitlePattern: (_x = pathConfig.pullRequestTitlePattern) !== null && _x !== void 0 ? _x : defaultConfig.pullRequestTitlePattern,
1034
+ pullRequestHeader: (_y = pathConfig.pullRequestHeader) !== null && _y !== void 0 ? _y : defaultConfig.pullRequestHeader,
1035
+ pullRequestFooter: (_z = pathConfig.pullRequestFooter) !== null && _z !== void 0 ? _z : defaultConfig.pullRequestFooter,
1036
+ separatePullRequests: (_0 = pathConfig.separatePullRequests) !== null && _0 !== void 0 ? _0 : defaultConfig.separatePullRequests,
1037
+ skipSnapshot: (_1 = pathConfig.skipSnapshot) !== null && _1 !== void 0 ? _1 : defaultConfig.skipSnapshot,
1038
+ initialVersion: (_2 = pathConfig.initialVersion) !== null && _2 !== void 0 ? _2 : defaultConfig.initialVersion,
1039
+ extraLabels: (_3 = pathConfig.extraLabels) !== null && _3 !== void 0 ? _3 : defaultConfig.extraLabels,
1040
+ excludePaths: (_4 = pathConfig.excludePaths) !== null && _4 !== void 0 ? _4 : defaultConfig.excludePaths,
1041
1041
  };
1042
1042
  }
1043
1043
  /**
@@ -4,6 +4,7 @@ import { GitHub } from '../github';
4
4
  interface MergeOptions {
5
5
  pullRequestTitlePattern?: string;
6
6
  pullRequestHeader?: string;
7
+ pullRequestFooter?: string;
7
8
  headBranchName?: string;
8
9
  forceMerge?: boolean;
9
10
  }
@@ -16,6 +17,7 @@ interface MergeOptions {
16
17
  export declare class Merge extends ManifestPlugin {
17
18
  private pullRequestTitlePattern?;
18
19
  private pullRequestHeader?;
20
+ private pullRequestFooter?;
19
21
  private headBranchName?;
20
22
  private forceMerge;
21
23
  constructor(github: GitHub, targetBranch: string, repositoryConfig: RepositoryConfig, options?: MergeOptions);
@@ -33,6 +33,7 @@ class Merge extends plugin_1.ManifestPlugin {
33
33
  this.pullRequestTitlePattern =
34
34
  (_a = options.pullRequestTitlePattern) !== null && _a !== void 0 ? _a : manifest_1.MANIFEST_PULL_REQUEST_TITLE_PATTERN;
35
35
  this.pullRequestHeader = options.pullRequestHeader;
36
+ this.pullRequestFooter = options.pullRequestFooter;
36
37
  this.headBranchName = options.headBranchName;
37
38
  this.forceMerge = (_b = options.forceMerge) !== null && _b !== void 0 ? _b : false;
38
39
  }
@@ -72,6 +73,7 @@ class Merge extends plugin_1.ManifestPlugin {
72
73
  body: new pull_request_body_1.PullRequestBody(releaseData, {
73
74
  useComponents: true,
74
75
  header: this.pullRequestHeader,
76
+ footer: this.pullRequestFooter,
75
77
  }),
76
78
  updates,
77
79
  labels: Array.from(labels),
@@ -43,6 +43,7 @@ export interface BaseStrategyOptions {
43
43
  includeVInTag?: boolean;
44
44
  pullRequestTitlePattern?: string;
45
45
  pullRequestHeader?: string;
46
+ pullRequestFooter?: string;
46
47
  extraFiles?: ExtraFile[];
47
48
  versionFile?: string;
48
49
  snapshotLabels?: string[];
@@ -74,6 +75,7 @@ export declare abstract class BaseStrategy implements Strategy {
74
75
  protected initialVersion?: string;
75
76
  readonly pullRequestTitlePattern?: string;
76
77
  readonly pullRequestHeader?: string;
78
+ readonly pullRequestFooter?: string;
77
79
  readonly extraFiles: ExtraFile[];
78
80
  readonly extraLabels: string[];
79
81
  readonly changelogNotes: ChangelogNotes;
@@ -101,7 +103,7 @@ export declare abstract class BaseStrategy implements Strategy {
101
103
  */
102
104
  protected postProcessCommits(commits: ConventionalCommit[]): Promise<ConventionalCommit[]>;
103
105
  protected buildReleaseNotes(conventionalCommits: ConventionalCommit[], newVersion: Version, newVersionTag: TagName, latestRelease?: Release, commits?: Commit[]): Promise<string>;
104
- protected buildPullRequestBody(component: string | undefined, newVersion: Version, releaseNotesBody: string, _conventionalCommits: ConventionalCommit[], _latestRelease?: Release, pullRequestHeader?: string): Promise<PullRequestBody>;
106
+ protected buildPullRequestBody(component: string | undefined, newVersion: Version, releaseNotesBody: string, _conventionalCommits: ConventionalCommit[], _latestRelease?: Release, pullRequestHeader?: string, pullRequestFooter?: string): Promise<PullRequestBody>;
105
107
  /**
106
108
  * Builds a candidate release pull request
107
109
  * @param {Commit[]} commits Raw commits to consider for this release.
@@ -61,6 +61,7 @@ class BaseStrategy {
61
61
  this.includeVInTag = (_c = options.includeVInTag) !== null && _c !== void 0 ? _c : true;
62
62
  this.pullRequestTitlePattern = options.pullRequestTitlePattern;
63
63
  this.pullRequestHeader = options.pullRequestHeader;
64
+ this.pullRequestFooter = options.pullRequestFooter;
64
65
  this.extraFiles = options.extraFiles || [];
65
66
  this.initialVersion = options.initialVersion;
66
67
  this.extraLabels = options.extraLabels || [];
@@ -118,14 +119,17 @@ class BaseStrategy {
118
119
  commits: commits,
119
120
  });
120
121
  }
121
- async buildPullRequestBody(component, newVersion, releaseNotesBody, _conventionalCommits, _latestRelease, pullRequestHeader) {
122
+ async buildPullRequestBody(component, newVersion, releaseNotesBody, _conventionalCommits, _latestRelease, pullRequestHeader, pullRequestFooter) {
122
123
  return new pull_request_body_1.PullRequestBody([
123
124
  {
124
125
  component,
125
126
  version: newVersion,
126
127
  notes: releaseNotesBody,
127
128
  },
128
- ], { header: pullRequestHeader });
129
+ ], {
130
+ header: pullRequestHeader,
131
+ footer: pullRequestFooter,
132
+ });
129
133
  }
130
134
  /**
131
135
  * Builds a candidate release pull request
@@ -169,7 +173,7 @@ class BaseStrategy {
169
173
  commits: conventionalCommits,
170
174
  });
171
175
  const updatesWithExtras = (0, composite_1.mergeUpdates)(updates.concat(...(await this.extraFileUpdates(newVersion, versionsMap))));
172
- const pullRequestBody = await this.buildPullRequestBody(component, newVersion, releaseNotesBody, conventionalCommits, latestRelease, this.pullRequestHeader);
176
+ const pullRequestBody = await this.buildPullRequestBody(component, newVersion, releaseNotesBody, conventionalCommits, latestRelease, this.pullRequestHeader, this.pullRequestFooter);
173
177
  return {
174
178
  title: pullRequestTitle,
175
179
  body: pullRequestBody,
@@ -384,7 +388,12 @@ class BaseStrategy {
384
388
  if (notes === undefined) {
385
389
  this.logger.warn('Failed to find release notes');
386
390
  }
387
- const version = pullRequestTitle.getVersion() || (releaseData === null || releaseData === void 0 ? void 0 : releaseData.version);
391
+ let version = pullRequestTitle.getVersion();
392
+ if (!version ||
393
+ (pullRequestBody.releaseData.length > 1 && (releaseData === null || releaseData === void 0 ? void 0 : releaseData.version))) {
394
+ // prioritize pull-request body version for multi-component releases
395
+ version = releaseData === null || releaseData === void 0 ? void 0 : releaseData.version;
396
+ }
388
397
  if (!version) {
389
398
  this.logger.error('Pull request should have included version');
390
399
  return;
@@ -34,17 +34,20 @@ const CHANGELOG_SECTIONS = [
34
34
  const DEFAULT_CHANGELOG_PATH = 'docs/history.md';
35
35
  const DEFAULT_PULL_REQUEST_TITLE_PATTERN = 'Release${component} version ${version}';
36
36
  const DEFAULT_PULL_REQUEST_HEADER = ':robot: I have created a release *beep* *boop*';
37
+ const DEFAULT_PULL_REQUEST_FOOTER = 'This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).';
37
38
  const RELEASE_NOTES_HEADER_PATTERN = /#{2,3} \[?(\d+\.\d+\.\d+-?[^\]]*)\]?.* \((\d{4}-\d{2}-\d{2})\)/;
38
39
  class DotnetYoshi extends base_1.BaseStrategy {
39
40
  constructor(options) {
40
- var _a, _b, _c, _d, _e;
41
+ var _a, _b, _c, _d, _e, _f;
41
42
  options.changelogSections = (_a = options.changelogSections) !== null && _a !== void 0 ? _a : CHANGELOG_SECTIONS;
42
43
  options.changelogPath = (_b = options.changelogPath) !== null && _b !== void 0 ? _b : DEFAULT_CHANGELOG_PATH;
43
44
  options.pullRequestTitlePattern =
44
45
  (_c = options.pullRequestTitlePattern) !== null && _c !== void 0 ? _c : DEFAULT_PULL_REQUEST_TITLE_PATTERN;
45
46
  options.pullRequestHeader =
46
47
  (_d = options.pullRequestHeader) !== null && _d !== void 0 ? _d : DEFAULT_PULL_REQUEST_HEADER;
47
- options.includeVInTag = (_e = options.includeVInTag) !== null && _e !== void 0 ? _e : false;
48
+ options.pullRequestFooter =
49
+ (_e = options.pullRequestFooter) !== null && _e !== void 0 ? _e : DEFAULT_PULL_REQUEST_FOOTER;
50
+ options.includeVInTag = (_f = options.includeVInTag) !== null && _f !== void 0 ? _f : false;
48
51
  super(options);
49
52
  }
50
53
  async buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease) {
@@ -29,6 +29,14 @@ class PackageLockJson extends default_1.DefaultUpdater {
29
29
  if (parsed.lockfileVersion === 2 || parsed.lockfileVersion === 3) {
30
30
  parsed.packages[''].version = this.version.toString();
31
31
  }
32
+ if (this.versionsMap) {
33
+ for (const [, obj] of Object.entries(parsed.packages)) {
34
+ const ver = this.versionsMap.get(obj.name);
35
+ if (ver) {
36
+ obj.version = ver.toString();
37
+ }
38
+ }
39
+ }
32
40
  return (0, json_stringify_1.jsonStringify)(parsed, content);
33
41
  }
34
42
  }
@@ -64,6 +64,7 @@ function releaserConfigToJsonConfig(config) {
64
64
  'changelog-host': config.changelogHost,
65
65
  'pull-request-title-pattern': config.pullRequestTitlePattern,
66
66
  'pull-request-header': config.pullRequestHeader,
67
+ 'pull-request-footer': config.pullRequestFooter,
67
68
  'separate-pull-requests': config.separatePullRequests,
68
69
  'tag-separator': config.tagSeparator,
69
70
  'extra-files': config.extraFiles,
@@ -127,7 +127,7 @@ function extractMultipleReleases(notes, logger) {
127
127
  }
128
128
  return data;
129
129
  }
130
- const COMPARE_REGEX = /^#{2,} \[?(?<version>\d+\.\d+\.\d+.*)\]?/;
130
+ const COMPARE_REGEX = /^#{2,} \[?(?<version>\d+\.\d+\.\d+[^\]]*)\]?/;
131
131
  function extractSingleRelease(body, logger) {
132
132
  var _a;
133
133
  body = body.trim();
@@ -30,5 +30,6 @@ export declare class Version {
30
30
  * @returns {string}
31
31
  */
32
32
  toString(): string;
33
+ get isPreMajor(): boolean;
33
34
  }
34
35
  export type VersionsMap = Map<string, Version>;
@@ -66,6 +66,9 @@ class Version {
66
66
  const buildPart = this.build ? `+${this.build}` : '';
67
67
  return `${this.major}.${this.minor}.${this.patch}${preReleasePart}${buildPart}`;
68
68
  }
69
+ get isPreMajor() {
70
+ return this.major < 1;
71
+ }
69
72
  }
70
73
  exports.Version = Version;
71
74
  //# sourceMappingURL=version.js.map
@@ -2,7 +2,7 @@ import { VersioningStrategy, VersionUpdater } from '../versioning-strategy';
2
2
  import { ConventionalCommit } from '../commit';
3
3
  import { Version } from '../version';
4
4
  import { Logger } from '../util/logger';
5
- interface DefaultVersioningStrategyOptions {
5
+ export interface DefaultVersioningStrategyOptions {
6
6
  bumpMinorPreMajor?: boolean;
7
7
  bumpPatchForMinorPreMajor?: boolean;
8
8
  logger?: Logger;
@@ -46,4 +46,3 @@ export declare class DefaultVersioningStrategy implements VersioningStrategy {
46
46
  */
47
47
  bump(version: Version, commits: ConventionalCommit[]): Version;
48
48
  }
49
- export {};
@@ -66,7 +66,7 @@ class DefaultVersioningStrategy {
66
66
  }
67
67
  }
68
68
  if (breaking > 0) {
69
- if (version.major < 1 && this.bumpMinorPreMajor) {
69
+ if (version.isPreMajor && this.bumpMinorPreMajor) {
70
70
  return new versioning_strategy_1.MinorVersionUpdate();
71
71
  }
72
72
  else {
@@ -74,7 +74,7 @@ class DefaultVersioningStrategy {
74
74
  }
75
75
  }
76
76
  else if (features > 0) {
77
- if (version.major < 1 && this.bumpPatchForMinorPreMajor) {
77
+ if (version.isPreMajor && this.bumpPatchForMinorPreMajor) {
78
78
  return new versioning_strategy_1.PatchVersionUpdate();
79
79
  }
80
80
  else {
@@ -46,7 +46,7 @@ class DependencyManifest extends default_1.DefaultVersioningStrategy {
46
46
  }
47
47
  let dependencyBump;
48
48
  if (breaking > 0) {
49
- if (version.major < 1 && this.bumpMinorPreMajor) {
49
+ if (version.isPreMajor && this.bumpMinorPreMajor) {
50
50
  dependencyBump = new versioning_strategy_1.MinorVersionUpdate();
51
51
  }
52
52
  else {
@@ -54,7 +54,7 @@ class DependencyManifest extends default_1.DefaultVersioningStrategy {
54
54
  }
55
55
  }
56
56
  else if (features > 0) {
57
- if (version.major < 1 && this.bumpPatchForMinorPreMajor) {
57
+ if (version.isPreMajor && this.bumpPatchForMinorPreMajor) {
58
58
  dependencyBump = new versioning_strategy_1.PatchVersionUpdate();
59
59
  }
60
60
  else {
@@ -1,12 +1,18 @@
1
- import { DefaultVersioningStrategy } from './default';
1
+ import { DefaultVersioningStrategyOptions, DefaultVersioningStrategy } from './default';
2
2
  import { Version } from '../version';
3
3
  import { ConventionalCommit } from '..';
4
4
  import { VersionUpdater } from '../versioning-strategy';
5
+ interface PrereleaseVersioningStrategyOptions extends DefaultVersioningStrategyOptions {
6
+ prereleaseType?: string;
7
+ }
5
8
  /**
6
9
  * This versioning strategy will increment the pre-release number for patch
7
10
  * bumps if there is a pre-release number (preserving any leading 0s).
8
11
  * Example: 1.2.3-beta01 -> 1.2.3-beta02.
9
12
  */
10
13
  export declare class PrereleaseVersioningStrategy extends DefaultVersioningStrategy {
14
+ readonly prereleaseType?: string;
15
+ constructor(options?: PrereleaseVersioningStrategyOptions);
11
16
  determineReleaseType(version: Version, commits: ConventionalCommit[]): VersionUpdater;
12
17
  }
18
+ export {};
@@ -17,8 +17,39 @@ exports.PrereleaseVersioningStrategy = void 0;
17
17
  const default_1 = require("./default");
18
18
  const version_1 = require("../version");
19
19
  const versioning_strategy_1 = require("../versioning-strategy");
20
- const PRERELEASE_PATTERN = /^(?<type>[a-z]+)(?<number>\d+)$/;
21
- class PrereleasePatchVersionUpdate {
20
+ /**
21
+ * Regex to match the last set of numbers in a string
22
+ * Example: 1.2.3-beta01-01 -> 01
23
+ */
24
+ const PRERELEASE_NUMBER = /(?<number>\d+)(?=\D*$)/;
25
+ class AbstractPrereleaseVersionUpdate {
26
+ constructor(prereleaseType) {
27
+ this.prereleaseType = prereleaseType;
28
+ }
29
+ /**
30
+ * Returns the new bumped prerelease version
31
+ *
32
+ * That is, if the current version is 1.2.3-beta01, the next prerelease version
33
+ * will be 1.2.3-beta02. If no number is found, the prerelease version will be
34
+ * 1.2.3-beta. If multiple numbers are found, the last set of numbers will be
35
+ * incremented, e.g. 1.2.3-beta01-01 -> 1.2.3-beta01-02.
36
+ *
37
+ * @param {prerelease} string The current version
38
+ * @returns {Version} The bumped version
39
+ */
40
+ bumpPrerelease(prerelease) {
41
+ const match = prerelease.match(PRERELEASE_NUMBER);
42
+ let nextPrerelease = `${prerelease}.1`;
43
+ if (match === null || match === void 0 ? void 0 : match.groups) {
44
+ const numberLength = match.groups.number.length;
45
+ const nextPrereleaseNumber = Number(match.groups.number) + 1;
46
+ const paddedNextPrereleaseNumber = `${nextPrereleaseNumber}`.padStart(numberLength, '0');
47
+ nextPrerelease = prerelease.replace(PRERELEASE_NUMBER, paddedNextPrereleaseNumber);
48
+ }
49
+ return nextPrerelease;
50
+ }
51
+ }
52
+ class PrereleasePatchVersionUpdate extends AbstractPrereleaseVersionUpdate {
22
53
  /**
23
54
  * Returns the new bumped version
24
55
  *
@@ -27,19 +58,13 @@ class PrereleasePatchVersionUpdate {
27
58
  */
28
59
  bump(version) {
29
60
  if (version.preRelease) {
30
- const match = version.preRelease.match(PRERELEASE_PATTERN);
31
- if (match === null || match === void 0 ? void 0 : match.groups) {
32
- const numberLength = match.groups.number.length;
33
- const nextPrereleaseNumber = Number(match.groups.number) + 1;
34
- const paddedNextPrereleaseNumber = `${nextPrereleaseNumber}`.padStart(numberLength, '0');
35
- const nextPrerelease = `${match.groups.type}${paddedNextPrereleaseNumber}`;
36
- return new version_1.Version(version.major, version.minor, version.patch, nextPrerelease, version.build);
37
- }
61
+ const nextPrerelease = this.bumpPrerelease(version.preRelease);
62
+ return new version_1.Version(version.major, version.minor, version.patch, nextPrerelease, version.build);
38
63
  }
39
- return new version_1.Version(version.major, version.minor, version.patch + 1, version.preRelease, version.build);
64
+ return new version_1.Version(version.major, version.minor, version.patch + 1, this.prereleaseType, version.build);
40
65
  }
41
66
  }
42
- class PrereleaseMinorVersionUpdate {
67
+ class PrereleaseMinorVersionUpdate extends AbstractPrereleaseVersionUpdate {
43
68
  /**
44
69
  * Returns the new bumped version
45
70
  *
@@ -48,28 +73,16 @@ class PrereleaseMinorVersionUpdate {
48
73
  */
49
74
  bump(version) {
50
75
  if (version.preRelease) {
51
- const match = version.preRelease.match(PRERELEASE_PATTERN);
52
- if (match === null || match === void 0 ? void 0 : match.groups) {
53
- const numberLength = match.groups.number.length;
54
- const prereleaseNumber = Number(match.groups.number);
55
- let nextPrereleaseNumber = 1;
56
- let nextMinorNumber = version.minor + 1;
57
- let nextPatchNumber = 0;
58
- if (version.patch === 0) {
59
- // this is already the next minor candidate, then bump the pre-release number
60
- nextPrereleaseNumber = prereleaseNumber + 1;
61
- nextMinorNumber = version.minor;
62
- nextPatchNumber = version.patch;
63
- }
64
- const paddedNextPrereleaseNumber = `${nextPrereleaseNumber}`.padStart(numberLength, '0');
65
- const nextPrerelease = `${match.groups.type}${paddedNextPrereleaseNumber}`;
66
- return new version_1.Version(version.major, nextMinorNumber, nextPatchNumber, nextPrerelease, version.build);
76
+ if (version.patch === 0) {
77
+ const nextPrerelease = this.bumpPrerelease(version.preRelease);
78
+ return new version_1.Version(version.major, version.minor, version.patch, nextPrerelease, version.build);
67
79
  }
80
+ return new versioning_strategy_1.MinorVersionUpdate().bump(version);
68
81
  }
69
- return new version_1.Version(version.major, version.minor + 1, 0, version.preRelease, version.build);
82
+ return new version_1.Version(version.major, version.minor + 1, 0, this.prereleaseType, version.build);
70
83
  }
71
84
  }
72
- class PrereleaseMajorVersionUpdate {
85
+ class PrereleaseMajorVersionUpdate extends AbstractPrereleaseVersionUpdate {
73
86
  /**
74
87
  * Returns the new bumped version
75
88
  *
@@ -78,27 +91,13 @@ class PrereleaseMajorVersionUpdate {
78
91
  */
79
92
  bump(version) {
80
93
  if (version.preRelease) {
81
- const match = version.preRelease.match(PRERELEASE_PATTERN);
82
- if (match === null || match === void 0 ? void 0 : match.groups) {
83
- const numberLength = match.groups.number.length;
84
- const prereleaseNumber = Number(match.groups.number);
85
- let nextPrereleaseNumber = 1;
86
- let nextMajorNumber = version.major + 1;
87
- let nextMinorNumber = 0;
88
- let nextPatchNumber = 0;
89
- if (version.patch === 0 && version.minor === 0) {
90
- // this is already the next major candidate, then bump the pre-release number
91
- nextPrereleaseNumber = prereleaseNumber + 1;
92
- nextMajorNumber = version.major;
93
- nextMinorNumber = version.minor;
94
- nextPatchNumber = version.patch;
95
- }
96
- const paddedNextPrereleaseNumber = `${nextPrereleaseNumber}`.padStart(numberLength, '0');
97
- const nextPrerelease = `${match.groups.type}${paddedNextPrereleaseNumber}`;
98
- return new version_1.Version(nextMajorNumber, nextMinorNumber, nextPatchNumber, nextPrerelease, version.build);
94
+ if (version.patch === 0 && version.minor === 0) {
95
+ const nextPrerelease = this.bumpPrerelease(version.preRelease);
96
+ return new version_1.Version(version.major, version.minor, version.patch, nextPrerelease, version.build);
99
97
  }
98
+ return new versioning_strategy_1.MajorVersionUpdate().bump(version);
100
99
  }
101
- return new version_1.Version(version.major + 1, 0, 0, version.preRelease, version.build);
100
+ return new version_1.Version(version.major + 1, 0, 0, this.prereleaseType, version.build);
102
101
  }
103
102
  }
104
103
  /**
@@ -107,6 +106,10 @@ class PrereleaseMajorVersionUpdate {
107
106
  * Example: 1.2.3-beta01 -> 1.2.3-beta02.
108
107
  */
109
108
  class PrereleaseVersioningStrategy extends default_1.DefaultVersioningStrategy {
109
+ constructor(options = {}) {
110
+ super(options);
111
+ this.prereleaseType = options.prereleaseType;
112
+ }
110
113
  determineReleaseType(version, commits) {
111
114
  // iterate through list of commits and find biggest commit type
112
115
  let breaking = 0;
@@ -126,22 +129,22 @@ class PrereleaseVersioningStrategy extends default_1.DefaultVersioningStrategy {
126
129
  }
127
130
  }
128
131
  if (breaking > 0) {
129
- if (version.major < 1 && this.bumpMinorPreMajor) {
130
- return new PrereleaseMinorVersionUpdate();
132
+ if (version.isPreMajor && this.bumpMinorPreMajor) {
133
+ return new PrereleaseMinorVersionUpdate(this.prereleaseType);
131
134
  }
132
135
  else {
133
- return new PrereleaseMajorVersionUpdate();
136
+ return new PrereleaseMajorVersionUpdate(this.prereleaseType);
134
137
  }
135
138
  }
136
139
  else if (features > 0) {
137
- if (version.major < 1 && this.bumpPatchForMinorPreMajor) {
138
- return new PrereleasePatchVersionUpdate();
140
+ if (version.isPreMajor && this.bumpPatchForMinorPreMajor) {
141
+ return new PrereleasePatchVersionUpdate(this.prereleaseType);
139
142
  }
140
143
  else {
141
- return new PrereleaseMinorVersionUpdate();
144
+ return new PrereleaseMinorVersionUpdate(this.prereleaseType);
142
145
  }
143
146
  }
144
- return new PrereleasePatchVersionUpdate();
147
+ return new PrereleasePatchVersionUpdate(this.prereleaseType);
145
148
  }
146
149
  }
147
150
  exports.PrereleaseVersioningStrategy = PrereleaseVersioningStrategy;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-please",
3
- "version": "16.0.0",
3
+ "version": "16.2.0",
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",
@@ -20,6 +20,10 @@
20
20
  "description": "Feature changes only bump semver patch if version < 1.0.0",
21
21
  "type": "boolean"
22
22
  },
23
+ "prerelease-type": {
24
+ "description": "Configuration option for the prerelese versioning strategy. If prerelease strategy used and type set, will set the prerelese part of the version to the provided value in case prerelease part is not present.",
25
+ "type": "string"
26
+ },
23
27
  "versioning": {
24
28
  "description": "Versioning strategy. Defaults to `default`",
25
29
  "type": "string"
@@ -99,6 +103,10 @@
99
103
  "description": "Customize the release pull request header.",
100
104
  "type": "string"
101
105
  },
106
+ "pull-request-footer": {
107
+ "description": "Customize the release pull request footer.",
108
+ "type": "string"
109
+ },
102
110
  "separate-pull-requests": {
103
111
  "description": "Open a separate release pull request for each component. Defaults to `false`.",
104
112
  "type": "boolean"
@@ -290,7 +298,11 @@
290
298
  "type": {
291
299
  "description": "The name of the plugin.",
292
300
  "type": "string",
293
- "enum": ["cargo-workspace", "maven-workspace", "node-workspace"]
301
+ "enum": [
302
+ "cargo-workspace",
303
+ "maven-workspace",
304
+ "node-workspace"
305
+ ]
294
306
  },
295
307
  "updateAllPackages": {
296
308
  "description": "Whether to force updating all packages regardless of the dependency tree. Defaults to `false`.",
@@ -396,6 +408,7 @@
396
408
  "changelog-path": true,
397
409
  "pull-request-title-pattern": true,
398
410
  "pull-request-header": true,
411
+ "pull-request-footer": true,
399
412
  "separate-pull-requests": true,
400
413
  "tag-separator": true,
401
414
  "extra-files": true,