release-please 13.7.1 → 13.9.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.
Files changed (37) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +9 -6
  3. package/build/src/bin/release-please.d.ts +1 -0
  4. package/build/src/bin/release-please.js +15 -0
  5. package/build/src/factory.d.ts +1 -1
  6. package/build/src/factory.js +25 -1
  7. package/build/src/manifest.d.ts +16 -1
  8. package/build/src/manifest.js +39 -27
  9. package/build/src/strategies/base.d.ts +5 -3
  10. package/build/src/strategies/base.js +16 -8
  11. package/build/src/strategies/dotnet-yoshi.d.ts +12 -0
  12. package/build/src/strategies/dotnet-yoshi.js +96 -0
  13. package/build/src/strategies/java-yoshi.d.ts +4 -14
  14. package/build/src/strategies/java-yoshi.js +3 -83
  15. package/build/src/strategies/java.d.ts +28 -0
  16. package/build/src/strategies/java.js +160 -0
  17. package/build/src/strategies/maven.d.ts +9 -0
  18. package/build/src/strategies/maven.js +56 -0
  19. package/build/src/strategies/php-yoshi.js +2 -1
  20. package/build/src/strategies/ruby-yoshi.d.ts +3 -3
  21. package/build/src/strategies/ruby-yoshi.js +11 -46
  22. package/build/src/strategy.d.ts +7 -0
  23. package/build/src/updaters/base-xml.d.ts +19 -0
  24. package/build/src/updaters/base-xml.js +39 -0
  25. package/build/src/updaters/dotnet/apis.d.ts +17 -0
  26. package/build/src/updaters/dotnet/apis.js +45 -0
  27. package/build/src/updaters/generic-xml.d.ts +5 -10
  28. package/build/src/updaters/generic-xml.js +11 -20
  29. package/build/src/updaters/generic.d.ts +16 -4
  30. package/build/src/updaters/generic.js +13 -6
  31. package/build/src/updaters/java/java-released.d.ts +28 -0
  32. package/build/src/updaters/java/java-released.js +59 -0
  33. package/build/src/updaters/java/pom-xml.d.ts +14 -0
  34. package/build/src/updaters/java/pom-xml.js +52 -0
  35. package/build/src/util/tag-name.d.ts +2 -1
  36. package/build/src/util/tag-name.js +6 -5
  37. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,33 @@
4
4
 
5
5
  [1]: https://www.npmjs.com/package/release-please?activeTab=versions
6
6
 
7
+ ## [13.9.0](https://github.com/googleapis/release-please/compare/v13.8.1...v13.9.0) (2022-04-12)
8
+
9
+
10
+ ### Features
11
+
12
+ * added java strategy ([#1333](https://github.com/googleapis/release-please/issues/1333)) ([25f9c85](https://github.com/googleapis/release-please/commit/25f9c85a8472208a83dfd5cc4014c84adc3c771f))
13
+
14
+ ### [13.8.1](https://github.com/googleapis/release-please/compare/v13.8.0...v13.8.1) (2022-04-11)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * Restore v12 changelog formatting for ruby-yoshi ([#1361](https://github.com/googleapis/release-please/issues/1361)) ([ff87c7d](https://github.com/googleapis/release-please/commit/ff87c7df00b652512641454ead34bb2cede2f67e))
20
+
21
+ ## [13.8.0](https://github.com/googleapis/release-please/compare/v13.7.1...v13.8.0) (2022-03-31)
22
+
23
+
24
+ ### Features
25
+
26
+ * add dotnet-yoshi strategy ([#1346](https://github.com/googleapis/release-please/issues/1346)) ([3086e51](https://github.com/googleapis/release-please/commit/3086e5148e596751a2c2b82c28a7b3d3c1b960f2))
27
+ * allow configuring tag without "v" ([3086e51](https://github.com/googleapis/release-please/commit/3086e5148e596751a2c2b82c28a7b3d3c1b960f2))
28
+
29
+
30
+ ### Bug Fixes
31
+
32
+ * **php-yoshi:** correctly ignore non-client directories ([#1358](https://github.com/googleapis/release-please/issues/1358)) ([58647dd](https://github.com/googleapis/release-please/commit/58647dd22d994ba670e762a2cef6b99b4b234af8)), closes [#1356](https://github.com/googleapis/release-please/issues/1356)
33
+
7
34
  ### [13.7.1](https://github.com/googleapis/release-please/compare/v13.7.0...v13.7.1) (2022-03-30)
8
35
 
9
36
 
package/README.md CHANGED
@@ -32,9 +32,10 @@ When the Release PR is merged, release-please takes the following steps:
32
32
  You can tell where the Release PR is its lifecycle by the status label on the
33
33
  PR itself:
34
34
 
35
- - `autorelease:pending` is the initial state of the Release PR before it is merged
36
- - `autorelease:tagged` means that the Release PR has been merged and the release has been tagged in GitHub
37
- - `autorelease:published` means that a GitHub release has been published based on the Release PR (_release-please does not automatically add this tag, but we recommend it as a convention for publication tooling_).
35
+ - `autorelease: pending` is the initial state of the Release PR before it is merged
36
+ - `autorelease: tagged` means that the Release PR has been merged and the release has been tagged in GitHub
37
+ - `autorelease: snapshot` is special state for snapshot version bumps
38
+ - `autorelease: published` means that a GitHub release has been published based on the Release PR (_release-please does not automatically add this tag, but we recommend it as a convention for publication tooling_).
38
39
 
39
40
  ## How should I write my commits?
40
41
 
@@ -112,7 +113,7 @@ commit message instead of the merged commit message.
112
113
  ## Release Please bot does not create a release PR. Why?
113
114
 
114
115
  Release Please creates a release pull request after it sees the default branch
115
- contains "releaseable units" since the last release.
116
+ contains "releasable units" since the last release.
116
117
  A releasable unit is a commit to the branch with one of the following
117
118
  prefixes: "feat" and "fix". (A "chore" commit is not a releasable unit.)
118
119
 
@@ -123,13 +124,15 @@ Some languages have their specific releasable unit configuration. For example,
123
124
 
124
125
  Release Please automates releases for the following flavors of repositories:
125
126
 
126
- | release type | description
127
- |-------------------|---------------------------------------------------------|
127
+ | release type | description |
128
+ |---------------------|---------------------------------------------------------|
128
129
  | `dart` | A repository with a pubspec.yaml and a CHANGELOG.md |
129
130
  | `elixir` | A repository with a mix.exs and a CHANGELOG.md |
130
131
  | `go` | A repository with a CHANGELOG.md |
131
132
  | `helm` | A repository with a Chart.yaml and a CHANGELOG.md |
133
+ | `java` | [A strategy that generates SNAPSHOT version after each release](docs/java.md) |
132
134
  | `krm-blueprint` | [A kpt package, with 1 or more KRM files and a CHANGELOG.md](https://github.com/GoogleCloudPlatform/blueprints/tree/main/catalog/project) |
135
+ | `maven` | [Strategy for Maven projects, generates SNAPSHOT version after each release and updates `pom.xml` automatically](docs/java.md) |
133
136
  | `node` | [A Node.js repository, with a package.json and CHANGELOG.md](https://github.com/yargs/yargs) |
134
137
  | `ocaml` | [An OCaml repository, containing 1 or more opam or esy files and a CHANGELOG.md](https://github.com/grain-lang/binaryen.ml) |
135
138
  | `php` | A repository with a composer.json and a CHANGELOG.md |
@@ -41,6 +41,7 @@ interface ReleaseArgs {
41
41
  draft?: boolean;
42
42
  prerelease?: boolean;
43
43
  releaseLabel?: string;
44
+ snapshotLabel?: string;
44
45
  label?: string;
45
46
  }
46
47
  interface PullRequestArgs {
@@ -91,6 +91,11 @@ function releaseOptions(yargs) {
91
91
  describe: 'set a pull request label other than "autorelease: tagged"',
92
92
  default: 'autorelease: tagged',
93
93
  type: 'string',
94
+ })
95
+ .option('snapshot-label', {
96
+ describe: 'set a java snapshot pull request label other than "autorelease: snapshot"',
97
+ default: 'autorelease: snapshot',
98
+ type: 'string',
94
99
  });
95
100
  }
96
101
  function pullRequestOptions(yargs) {
@@ -238,6 +243,11 @@ function manifestOptions(yargs) {
238
243
  }
239
244
  function taggingOptions(yargs) {
240
245
  return yargs
246
+ .option('include-v-in-tags', {
247
+ describe: 'include "v" in tag versions',
248
+ type: 'boolean',
249
+ default: true,
250
+ })
241
251
  .option('monorepo-tags', {
242
252
  describe: 'include library name in tags and release branches',
243
253
  type: 'boolean',
@@ -275,6 +285,7 @@ const createReleasePullRequestCommand = {
275
285
  extraFiles: argv.extraFiles,
276
286
  versionFile: argv.versionFile,
277
287
  includeComponentInTag: argv.monorepoTags,
288
+ includeVInTag: argv.includeVInTags,
278
289
  }, extractManifestOptions(argv), argv.path);
279
290
  }
280
291
  else {
@@ -324,6 +335,7 @@ const createReleaseCommand = {
324
335
  draft: argv.draft,
325
336
  prerelease: argv.prerelease,
326
337
  includeComponentInTag: argv.monorepoTags,
338
+ includeVInTag: argv.includeVInTags,
327
339
  }, extractManifestOptions(argv), argv.path);
328
340
  }
329
341
  else {
@@ -498,6 +510,9 @@ function extractManifestOptions(argv) {
498
510
  if ('releaseLabel' in argv && argv.releaseLabel) {
499
511
  manifestOptions.releaseLabels = argv.releaseLabel.split(',');
500
512
  }
513
+ if ('snapshotLabel' in argv && argv.snapshotLabel) {
514
+ manifestOptions.snapshotLabels = argv.snapshotLabel.split(',');
515
+ }
501
516
  if ('signoff' in argv && argv.signoff) {
502
517
  manifestOptions.signoff = argv.signoff;
503
518
  }
@@ -3,7 +3,7 @@ import { GitHub } from './github';
3
3
  import { ReleaserConfig, PluginType, RepositoryConfig } from './manifest';
4
4
  import { ManifestPlugin } from './plugin';
5
5
  import { ChangelogNotes, ChangelogSection } from './changelog-notes';
6
- declare const allReleaseTypes: readonly ["dart", "elixir", "go", "go-yoshi", "helm", "java-backport", "java-bom", "java-lts", "java-yoshi", "krm-blueprint", "node", "ocaml", "php", "php-yoshi", "python", "ruby", "ruby-yoshi", "rust", "simple", "terraform-module"];
6
+ declare const allReleaseTypes: readonly ["dart", "dotnet-yoshi", "elixir", "go", "go-yoshi", "helm", "java", "java-backport", "java-bom", "java-lts", "java-yoshi", "krm-blueprint", "maven", "node", "ocaml", "php", "php-yoshi", "python", "ruby", "ruby-yoshi", "rust", "simple", "terraform-module"];
7
7
  export declare type ReleaseType = typeof allReleaseTypes[number];
8
8
  export declare function getReleaserTypes(): readonly ReleaseType[];
9
9
  export declare function getVersioningStrategyTypes(): readonly VersioningStrategyType[];
@@ -40,21 +40,27 @@ const cargo_workspace_1 = require("./plugins/cargo-workspace");
40
40
  const github_1 = require("./changelog-notes/github");
41
41
  const default_2 = require("./changelog-notes/default");
42
42
  const linked_versions_1 = require("./plugins/linked-versions");
43
+ const dotnet_yoshi_1 = require("./strategies/dotnet-yoshi");
44
+ const java_1 = require("./strategies/java");
45
+ const maven_1 = require("./strategies/maven");
43
46
  // Factory shared by GitHub Action and CLI for creating Release PRs
44
47
  // and GitHub Releases:
45
48
  // add any new releasers you create to this type as well as the `releasers`
46
49
  // object below.
47
50
  const allReleaseTypes = [
48
51
  'dart',
52
+ 'dotnet-yoshi',
49
53
  'elixir',
50
54
  'go',
51
55
  'go-yoshi',
52
56
  'helm',
57
+ 'java',
53
58
  'java-backport',
54
59
  'java-bom',
55
60
  'java-lts',
56
61
  'java-yoshi',
57
62
  'krm-blueprint',
63
+ 'maven',
58
64
  'node',
59
65
  'ocaml',
60
66
  'php',
@@ -67,9 +73,9 @@ const allReleaseTypes = [
67
73
  'terraform-module',
68
74
  ];
69
75
  const releasers = {
76
+ 'dotnet-yoshi': options => new dotnet_yoshi_1.DotnetYoshi(options),
70
77
  go: options => new go_1.Go(options),
71
78
  'go-yoshi': options => new go_yoshi_1.GoYoshi(options),
72
- 'java-yoshi': options => new java_yoshi_1.JavaYoshi(options),
73
79
  'krm-blueprint': options => new krm_blueprint_1.KRMBlueprint(options),
74
80
  node: options => new node_1.Node(options),
75
81
  ocaml: options => new ocaml_1.OCaml(options),
@@ -139,6 +145,24 @@ async function buildStrategy(options) {
139
145
  versionFile: options.versionFile,
140
146
  });
141
147
  }
148
+ case 'java': {
149
+ return new java_1.Java({
150
+ ...strategyOptions,
151
+ snapshotLabels: options.snapshotLabels,
152
+ });
153
+ }
154
+ case 'maven': {
155
+ return new maven_1.Maven({
156
+ ...strategyOptions,
157
+ snapshotLabels: options.snapshotLabels,
158
+ });
159
+ }
160
+ case 'java-yoshi': {
161
+ return new java_yoshi_1.JavaYoshi({
162
+ ...strategyOptions,
163
+ snapshotLabels: options.snapshotLabels,
164
+ });
165
+ }
142
166
  case 'java-backport': {
143
167
  return new java_yoshi_1.JavaYoshi({
144
168
  ...strategyOptions,
@@ -15,7 +15,11 @@ declare type ExtraXmlFile = {
15
15
  path: string;
16
16
  xpath: string;
17
17
  };
18
- export declare type ExtraFile = string | ExtraJsonFile | ExtraXmlFile;
18
+ declare type ExtraPomFile = {
19
+ type: 'pom';
20
+ path: string;
21
+ };
22
+ export declare type ExtraFile = string | ExtraJsonFile | ExtraXmlFile | ExtraPomFile;
19
23
  /**
20
24
  * These are configurations provided to each strategy per-path.
21
25
  */
@@ -32,6 +36,7 @@ export interface ReleaserConfig {
32
36
  component?: string;
33
37
  packageName?: string;
34
38
  includeComponentInTag?: boolean;
39
+ includeVInTag?: boolean;
35
40
  pullRequestTitlePattern?: string;
36
41
  tagSeparator?: string;
37
42
  changelogSections?: ChangelogSection[];
@@ -39,6 +44,7 @@ export interface ReleaserConfig {
39
44
  changelogType?: ChangelogNotesType;
40
45
  versionFile?: string;
41
46
  extraFiles?: ExtraFile[];
47
+ snapshotLabels?: string[];
42
48
  }
43
49
  export interface CandidateReleasePullRequest {
44
50
  path: string;
@@ -64,11 +70,13 @@ interface ReleaserConfigJson {
64
70
  label?: string;
65
71
  'release-label'?: string;
66
72
  'include-component-in-tag'?: boolean;
73
+ 'include-v-in-tag'?: boolean;
67
74
  'changelog-type'?: ChangelogNotesType;
68
75
  'pull-request-title-pattern'?: string;
69
76
  'tag-separator'?: string;
70
77
  'version-file'?: string;
71
78
  'extra-files'?: string[];
79
+ 'snapshot-label'?: string;
72
80
  }
73
81
  export interface ManifestOptions {
74
82
  bootstrapSha?: string;
@@ -81,6 +89,7 @@ export interface ManifestOptions {
81
89
  manifestPath?: string;
82
90
  labels?: string[];
83
91
  releaseLabels?: string[];
92
+ snapshotLabels?: string[];
84
93
  draft?: boolean;
85
94
  prerelease?: boolean;
86
95
  draftPullRequest?: boolean;
@@ -115,6 +124,11 @@ export declare type RepositoryConfig = Record<string, ReleaserConfig>;
115
124
  export declare const DEFAULT_RELEASE_PLEASE_CONFIG = "release-please-config.json";
116
125
  export declare const DEFAULT_RELEASE_PLEASE_MANIFEST = ".release-please-manifest.json";
117
126
  export declare const ROOT_PROJECT_PATH = ".";
127
+ export declare const DEFAULT_COMPONENT_NAME = "";
128
+ export declare const DEFAULT_LABELS: string[];
129
+ export declare const DEFAULT_RELEASE_LABELS: string[];
130
+ export declare const DEFAULT_SNAPSHOT_LABELS: string[];
131
+ export declare const SNOOZE_LABEL = "autorelease: snooze";
118
132
  export declare const MANIFEST_PULL_REQUEST_TITLE_PATTERN = "chore: release ${branch}";
119
133
  interface CreatedRelease extends GitHubRelease {
120
134
  path: string;
@@ -134,6 +148,7 @@ export declare class Manifest {
134
148
  private signoffUser?;
135
149
  private labels;
136
150
  private releaseLabels;
151
+ private snapshotLabels;
137
152
  private plugins;
138
153
  private _strategiesByPath?;
139
154
  private _pathsByComponent?;
@@ -13,7 +13,7 @@
13
13
  // See the License for the specific language governing permissions and
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.Manifest = exports.MANIFEST_PULL_REQUEST_TITLE_PATTERN = exports.ROOT_PROJECT_PATH = exports.DEFAULT_RELEASE_PLEASE_MANIFEST = exports.DEFAULT_RELEASE_PLEASE_CONFIG = void 0;
16
+ exports.Manifest = exports.MANIFEST_PULL_REQUEST_TITLE_PATTERN = exports.SNOOZE_LABEL = exports.DEFAULT_SNAPSHOT_LABELS = exports.DEFAULT_RELEASE_LABELS = exports.DEFAULT_LABELS = exports.DEFAULT_COMPONENT_NAME = exports.ROOT_PROJECT_PATH = exports.DEFAULT_RELEASE_PLEASE_MANIFEST = exports.DEFAULT_RELEASE_PLEASE_CONFIG = void 0;
17
17
  const version_1 = require("./version");
18
18
  const logger_1 = require("./util/logger");
19
19
  const commit_split_1 = require("./util/commit-split");
@@ -28,10 +28,11 @@ const errors_1 = require("./errors");
28
28
  exports.DEFAULT_RELEASE_PLEASE_CONFIG = 'release-please-config.json';
29
29
  exports.DEFAULT_RELEASE_PLEASE_MANIFEST = '.release-please-manifest.json';
30
30
  exports.ROOT_PROJECT_PATH = '.';
31
- const DEFAULT_COMPONENT_NAME = '';
32
- const DEFAULT_LABELS = ['autorelease: pending'];
33
- const DEFAULT_RELEASE_LABELS = ['autorelease: tagged'];
34
- const SNOOZE_LABEL = 'autorelease: snooze';
31
+ exports.DEFAULT_COMPONENT_NAME = '';
32
+ exports.DEFAULT_LABELS = ['autorelease: pending'];
33
+ exports.DEFAULT_RELEASE_LABELS = ['autorelease: tagged'];
34
+ exports.DEFAULT_SNAPSHOT_LABELS = ['autorelease: snapshot'];
35
+ exports.SNOOZE_LABEL = 'autorelease: snooze';
35
36
  exports.MANIFEST_PULL_REQUEST_TITLE_PATTERN = 'chore: release ${branch}';
36
37
  class Manifest {
37
38
  /**
@@ -73,8 +74,10 @@ class Manifest {
73
74
  this.fork = (manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.fork) || false;
74
75
  this.signoffUser = manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.signoff;
75
76
  this.releaseLabels =
76
- (manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.releaseLabels) || DEFAULT_RELEASE_LABELS;
77
- this.labels = (manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.labels) || DEFAULT_LABELS;
77
+ (manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.releaseLabels) || exports.DEFAULT_RELEASE_LABELS;
78
+ this.labels = (manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.labels) || exports.DEFAULT_LABELS;
79
+ this.snapshotLabels =
80
+ (manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.snapshotLabels) || exports.DEFAULT_SNAPSHOT_LABELS;
78
81
  this.bootstrapSha = manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.bootstrapSha;
79
82
  this.lastReleaseSha = manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.lastReleaseSha;
80
83
  this.draft = manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.draft;
@@ -135,7 +138,7 @@ class Manifest {
135
138
  });
136
139
  const component = await strategy.getComponent();
137
140
  const releasedVersions = {};
138
- const latestVersion = await latestReleaseVersion(github, targetBranch, config.includeComponentInTag ? component : '', config.pullRequestTitlePattern);
141
+ const latestVersion = await latestReleaseVersion(github, targetBranch, version => isPublishedVersion(strategy, version), config.includeComponentInTag ? component : '', config.pullRequestTitlePattern);
139
142
  if (latestVersion) {
140
143
  releasedVersions[path] = latestVersion;
141
144
  }
@@ -173,7 +176,7 @@ class Manifest {
173
176
  logger_1.logger.warn(`Unable to parse release name: ${release.name}`);
174
177
  continue;
175
178
  }
176
- const component = tagName.component || DEFAULT_COMPONENT_NAME;
179
+ const component = tagName.component || exports.DEFAULT_COMPONENT_NAME;
177
180
  const path = pathsByComponent[component];
178
181
  if (!path) {
179
182
  logger_1.logger.warn(`Found release tag with component '${component}', but not configured in manifest`);
@@ -321,7 +324,9 @@ class Manifest {
321
324
  const latestRelease = releasesByPath[path];
322
325
  const releasePullRequest = await strategy.buildReleasePullRequest(pathCommits, latestRelease, (_a = config.draftPullRequest) !== null && _a !== void 0 ? _a : this.draftPullRequest, this.labels);
323
326
  if (releasePullRequest) {
324
- if (releasePullRequest.version) {
327
+ // Update manifest, but only for valid release version - this will skip SNAPSHOT from java strategy
328
+ if (releasePullRequest.version &&
329
+ isPublishedVersion(strategy, releasePullRequest.version)) {
325
330
  const versionsMap = new Map();
326
331
  versionsMap.set(path, releasePullRequest.version);
327
332
  releasePullRequest.updates.push({
@@ -360,7 +365,7 @@ class Manifest {
360
365
  continue;
361
366
  }
362
367
  const component = await strategiesByPath[path].getComponent();
363
- const expectedTag = new tag_name_1.TagName(expectedVersion, component, this.repositoryConfig[path].tagSeparator);
368
+ const expectedTag = new tag_name_1.TagName(expectedVersion, component, this.repositoryConfig[path].tagSeparator, this.repositoryConfig[path].includeVInTag);
364
369
  logger_1.logger.debug(`looking for tagName: ${expectedTag.toString()}`);
365
370
  const foundTag = allTags[expectedTag.toString()];
366
371
  if (foundTag) {
@@ -415,7 +420,8 @@ class Manifest {
415
420
  const openPullRequests = [];
416
421
  const generator = this.github.pullRequestIterator(this.targetBranch, 'OPEN');
417
422
  for await (const openPullRequest of generator) {
418
- if (hasAllLabels(this.labels, openPullRequest.labels) &&
423
+ if ((hasAllLabels(this.labels, openPullRequest.labels) ||
424
+ hasAllLabels(this.snapshotLabels, openPullRequest.labels)) &&
419
425
  branch_name_1.BranchName.parse(openPullRequest.headBranchName) &&
420
426
  pull_request_body_1.PullRequestBody.parse(openPullRequest.body)) {
421
427
  openPullRequests.push(openPullRequest);
@@ -429,7 +435,7 @@ class Manifest {
429
435
  const snoozedPullRequests = [];
430
436
  const closedGenerator = this.github.pullRequestIterator(this.targetBranch, 'CLOSED');
431
437
  for await (const closedPullRequest of closedGenerator) {
432
- if (hasAllLabels([SNOOZE_LABEL], closedPullRequest.labels) &&
438
+ if (hasAllLabels([exports.SNOOZE_LABEL], closedPullRequest.labels) &&
433
439
  branch_name_1.BranchName.parse(closedPullRequest.headBranchName) &&
434
440
  pull_request_body_1.PullRequestBody.parse(closedPullRequest.body)) {
435
441
  snoozedPullRequests.push(closedPullRequest);
@@ -480,7 +486,7 @@ class Manifest {
480
486
  signoffUser: this.signoffUser,
481
487
  });
482
488
  // TODO: consider leaving the snooze label
483
- await this.github.removeIssueLabels([SNOOZE_LABEL], snoozed.number);
489
+ await this.github.removeIssueLabels([exports.SNOOZE_LABEL], snoozed.number);
484
490
  return updatedPullRequest;
485
491
  }
486
492
  async *findMergedReleasePullRequests() {
@@ -671,6 +677,7 @@ function extractReleaserConfig(config) {
671
677
  versionFile: config['version-file'],
672
678
  extraFiles: config['extra-files'],
673
679
  includeComponentInTag: config['include-component-in-tag'],
680
+ includeVInTag: config['include-v-in-tag'],
674
681
  changelogType: config['changelog-type'],
675
682
  pullRequestTitlePattern: config['pull-request-title-pattern'],
676
683
  tagSeparator: config['tag-separator'],
@@ -693,6 +700,7 @@ async function parseConfig(github, configFile, branch) {
693
700
  }
694
701
  const configLabel = config['label'];
695
702
  const configReleaseLabel = config['release-label'];
703
+ const configSnapshotLabel = config['snapshot-label'];
696
704
  const manifestOptions = {
697
705
  bootstrapSha: config['bootstrap-sha'],
698
706
  lastReleaseSha: config['last-release-sha'],
@@ -702,6 +710,7 @@ async function parseConfig(github, configFile, branch) {
702
710
  plugins: config['plugins'],
703
711
  labels: configLabel === undefined ? undefined : [configLabel],
704
712
  releaseLabels: configReleaseLabel === undefined ? undefined : [configReleaseLabel],
713
+ snapshotLabels: configSnapshotLabel === undefined ? undefined : [configSnapshotLabel],
705
714
  };
706
715
  return { config: repositoryConfig, options: manifestOptions };
707
716
  }
@@ -720,16 +729,22 @@ async function parseReleasedVersions(github, manifestFile, branch) {
720
729
  }
721
730
  return releasedVersions;
722
731
  }
732
+ function isPublishedVersion(strategy, version) {
733
+ return strategy.isPublishedVersion
734
+ ? strategy.isPublishedVersion(version)
735
+ : true;
736
+ }
723
737
  /**
724
738
  * Find the most recent matching release tag on the branch we're
725
739
  * configured for.
726
740
  *
727
- * @param {string} prefix - Limit the release to a specific component.
728
- * @param {boolean} preRelease - Whether or not to return pre-release
729
- * versions. Defaults to false.
741
+ * @param github GitHub client instance.
742
+ * @param {string} targetBranch Name of the scanned branch.
743
+ * @param releaseFilter Validator function for release version. Used to filter-out SNAPSHOT releases for Java strategy.
744
+ * @param {string} prefix Limit the release to a specific component.
745
+ * @param pullRequestTitlePattern Configured PR title pattern.
730
746
  */
731
- async function latestReleaseVersion(github, targetBranch, prefix, pullRequestTitlePattern) {
732
- var _a;
747
+ async function latestReleaseVersion(github, targetBranch, releaseFilter, prefix, pullRequestTitlePattern) {
733
748
  const branchPrefix = prefix
734
749
  ? prefix.endsWith('-')
735
750
  ? prefix.replace(/-$/, '')
@@ -764,11 +779,7 @@ async function latestReleaseVersion(github, targetBranch, prefix, pullRequestTit
764
779
  continue;
765
780
  }
766
781
  const version = pullRequestTitle.getVersion();
767
- if ((_a = version === null || version === void 0 ? void 0 : version.preRelease) === null || _a === void 0 ? void 0 : _a.includes('SNAPSHOT')) {
768
- // FIXME, don't hardcode this
769
- continue;
770
- }
771
- if (version) {
782
+ if (version && releaseFilter(version)) {
772
783
  logger_1.logger.debug(`Found latest release pull request: ${mergedPullRequest.number} version: ${version}`);
773
784
  candidateReleaseVersions.push(version);
774
785
  break;
@@ -818,7 +829,7 @@ async function latestReleaseVersion(github, targetBranch, prefix, pullRequestTit
818
829
  return candidateTagVersion.sort((a, b) => b.compare(a))[0];
819
830
  }
820
831
  function mergeReleaserConfig(defaultConfig, pathConfig) {
821
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
832
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
822
833
  return {
823
834
  releaseType: (_b = (_a = pathConfig.releaseType) !== null && _a !== void 0 ? _a : defaultConfig.releaseType) !== null && _b !== void 0 ? _b : 'node',
824
835
  bumpMinorPreMajor: (_c = pathConfig.bumpMinorPreMajor) !== null && _c !== void 0 ? _c : defaultConfig.bumpMinorPreMajor,
@@ -834,8 +845,9 @@ function mergeReleaserConfig(defaultConfig, pathConfig) {
834
845
  versionFile: (_o = pathConfig.versionFile) !== null && _o !== void 0 ? _o : defaultConfig.versionFile,
835
846
  extraFiles: (_p = pathConfig.extraFiles) !== null && _p !== void 0 ? _p : defaultConfig.extraFiles,
836
847
  includeComponentInTag: (_q = pathConfig.includeComponentInTag) !== null && _q !== void 0 ? _q : defaultConfig.includeComponentInTag,
837
- tagSeparator: (_r = pathConfig.tagSeparator) !== null && _r !== void 0 ? _r : defaultConfig.tagSeparator,
838
- pullRequestTitlePattern: (_s = pathConfig.pullRequestTitlePattern) !== null && _s !== void 0 ? _s : defaultConfig.pullRequestTitlePattern,
848
+ includeVInTag: (_r = pathConfig.includeVInTag) !== null && _r !== void 0 ? _r : defaultConfig.includeVInTag,
849
+ tagSeparator: (_s = pathConfig.tagSeparator) !== null && _s !== void 0 ? _s : defaultConfig.tagSeparator,
850
+ pullRequestTitlePattern: (_t = pathConfig.pullRequestTitlePattern) !== null && _t !== void 0 ? _t : defaultConfig.pullRequestTitlePattern,
839
851
  };
840
852
  }
841
853
  /**
@@ -37,6 +37,7 @@ export interface BaseStrategyOptions {
37
37
  releaseAs?: string;
38
38
  changelogNotes?: ChangelogNotes;
39
39
  includeComponentInTag?: boolean;
40
+ includeVInTag?: boolean;
40
41
  pullRequestTitlePattern?: string;
41
42
  extraFiles?: ExtraFile[];
42
43
  }
@@ -57,7 +58,8 @@ export declare abstract class BaseStrategy implements Strategy {
57
58
  private skipGitHubRelease;
58
59
  private releaseAs?;
59
60
  protected includeComponentInTag: boolean;
60
- private pullRequestTitlePattern?;
61
+ protected includeVInTag: boolean;
62
+ readonly pullRequestTitlePattern?: string;
61
63
  readonly extraFiles: ExtraFile[];
62
64
  readonly changelogNotes: ChangelogNotes;
63
65
  protected changelogSections?: ChangelogSection[];
@@ -96,9 +98,9 @@ export declare abstract class BaseStrategy implements Strategy {
96
98
  * open a pull request.
97
99
  */
98
100
  buildReleasePullRequest(commits: Commit[], latestRelease?: Release, draft?: boolean, labels?: string[]): Promise<ReleasePullRequest | undefined>;
99
- private extraFileUpdates;
101
+ protected extraFileUpdates(version: Version, versionsMap: VersionsMap): Update[];
100
102
  protected changelogEmpty(changelogEntry: string): boolean;
101
- protected updateVersionsMap(versionsMap: VersionsMap, conventionalCommits: ConventionalCommit[]): Promise<VersionsMap>;
103
+ protected updateVersionsMap(versionsMap: VersionsMap, conventionalCommits: ConventionalCommit[], _newVersion: Version): Promise<VersionsMap>;
102
104
  protected buildNewVersion(conventionalCommits: ConventionalCommit[], latestRelease?: Release): Promise<Version>;
103
105
  protected buildVersionsMap(_conventionalCommits: ConventionalCommit[]): Promise<VersionsMap>;
104
106
  protected parsePullRequestBody(pullRequestBody: string): Promise<PullRequestBody | undefined>;
@@ -28,6 +28,7 @@ const composite_1 = require("../updaters/composite");
28
28
  const generic_1 = require("../updaters/generic");
29
29
  const generic_json_1 = require("../updaters/generic-json");
30
30
  const generic_xml_1 = require("../updaters/generic-xml");
31
+ const pom_xml_1 = require("../updaters/java/pom-xml");
31
32
  const DEFAULT_CHANGELOG_PATH = 'CHANGELOG.md';
32
33
  /**
33
34
  * A strategy is responsible for determining which files are
@@ -35,7 +36,7 @@ const DEFAULT_CHANGELOG_PATH = 'CHANGELOG.md';
35
36
  */
36
37
  class BaseStrategy {
37
38
  constructor(options) {
38
- var _a;
39
+ var _a, _b;
39
40
  this.path = options.path || manifest_1.ROOT_PROJECT_PATH;
40
41
  this.github = options.github;
41
42
  this.packageName = options.packageName;
@@ -53,6 +54,7 @@ class BaseStrategy {
53
54
  this.changelogNotes =
54
55
  options.changelogNotes || new default_2.DefaultChangelogNotes(options);
55
56
  this.includeComponentInTag = (_a = options.includeComponentInTag) !== null && _a !== void 0 ? _a : true;
57
+ this.includeVInTag = (_b = options.includeVInTag) !== null && _b !== void 0 ? _b : true;
56
58
  this.pullRequestTitlePattern = options.pullRequestTitlePattern;
57
59
  this.extraFiles = options.extraFiles || [];
58
60
  }
@@ -133,10 +135,10 @@ class BaseStrategy {
133
135
  return undefined;
134
136
  }
135
137
  const newVersion = await this.buildNewVersion(conventionalCommits, latestRelease);
136
- const versionsMap = await this.updateVersionsMap(await this.buildVersionsMap(conventionalCommits), conventionalCommits);
138
+ const versionsMap = await this.updateVersionsMap(await this.buildVersionsMap(conventionalCommits), conventionalCommits, newVersion);
137
139
  const component = await this.getComponent();
138
140
  logger_1.logger.debug('component:', component);
139
- const newVersionTag = new tag_name_1.TagName(newVersion, this.includeComponentInTag ? component : undefined, this.tagSeparator);
141
+ const newVersionTag = new tag_name_1.TagName(newVersion, this.includeComponentInTag ? component : undefined, this.tagSeparator, this.includeVInTag);
140
142
  logger_1.logger.debug('pull request title pattern:', this.pullRequestTitlePattern);
141
143
  const pullRequestTitle = pull_request_title_1.PullRequestTitle.ofComponentTargetBranchVersion(component || '', this.targetBranch, newVersion, this.pullRequestTitlePattern);
142
144
  const branchName = component
@@ -153,7 +155,7 @@ class BaseStrategy {
153
155
  versionsMap,
154
156
  latestVersion: latestRelease === null || latestRelease === void 0 ? void 0 : latestRelease.tag.version,
155
157
  });
156
- const updatesWithExtras = composite_1.mergeUpdates(updates.concat(...this.extraFileUpdates(newVersion)));
158
+ const updatesWithExtras = composite_1.mergeUpdates(updates.concat(...this.extraFileUpdates(newVersion, versionsMap)));
157
159
  const pullRequestBody = await this.buildPullRequestBody(component, newVersion, releaseNotesBody, conventionalCommits, latestRelease);
158
160
  return {
159
161
  title: pullRequestTitle,
@@ -165,7 +167,7 @@ class BaseStrategy {
165
167
  draft: draft !== null && draft !== void 0 ? draft : false,
166
168
  };
167
169
  }
168
- extraFileUpdates(version) {
170
+ extraFileUpdates(version, versionsMap) {
169
171
  return this.extraFiles.map(extraFile => {
170
172
  if (typeof extraFile === 'object') {
171
173
  switch (extraFile.type) {
@@ -181,6 +183,12 @@ class BaseStrategy {
181
183
  createIfMissing: false,
182
184
  updater: new generic_xml_1.GenericXml(extraFile.xpath, version),
183
185
  };
186
+ case 'pom':
187
+ return {
188
+ path: this.addPath(extraFile.path),
189
+ createIfMissing: false,
190
+ updater: new pom_xml_1.PomXml(version),
191
+ };
184
192
  default:
185
193
  throw new Error(`unsupported extraFile type: ${extraFile.type}`);
186
194
  }
@@ -188,14 +196,14 @@ class BaseStrategy {
188
196
  return {
189
197
  path: this.addPath(extraFile),
190
198
  createIfMissing: false,
191
- updater: new generic_1.Generic({ version }),
199
+ updater: new generic_1.Generic({ version, versionsMap }),
192
200
  };
193
201
  });
194
202
  }
195
203
  changelogEmpty(changelogEntry) {
196
204
  return changelogEntry.split('\n').length <= 1;
197
205
  }
198
- async updateVersionsMap(versionsMap, conventionalCommits) {
206
+ async updateVersionsMap(versionsMap, conventionalCommits, _newVersion) {
199
207
  for (const versionKey of versionsMap.keys()) {
200
208
  const version = versionsMap.get(versionKey);
201
209
  if (!version) {
@@ -288,7 +296,7 @@ class BaseStrategy {
288
296
  logger_1.logger.error('Pull request should have included version');
289
297
  return;
290
298
  }
291
- const tag = new tag_name_1.TagName(version, this.includeComponentInTag ? component : undefined, this.tagSeparator);
299
+ const tag = new tag_name_1.TagName(version, this.includeComponentInTag ? component : undefined, this.tagSeparator, this.includeVInTag);
292
300
  const releaseName = component && this.includeComponentInTag
293
301
  ? `${component}: v${version.toString()}`
294
302
  : `v${version.toString()}`;
@@ -0,0 +1,12 @@
1
+ import { BaseStrategy, BuildUpdatesOptions, BaseStrategyOptions } from './base';
2
+ import { Update } from '../update';
3
+ import { ConventionalCommit } from '../commit';
4
+ import { Version } from '../version';
5
+ import { TagName } from '../util/tag-name';
6
+ import { Release } from '../release';
7
+ export declare class DotnetYoshi extends BaseStrategy {
8
+ constructor(options: BaseStrategyOptions);
9
+ protected buildReleaseNotes(conventionalCommits: ConventionalCommit[], newVersion: Version, newVersionTag: TagName, latestRelease?: Release): Promise<string>;
10
+ private getApi;
11
+ protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
12
+ }