release-please 13.16.3 → 13.16.4

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,31 @@
4
4
 
5
5
  [1]: https://www.npmjs.com/package/release-please?activeTab=versions
6
6
 
7
+ ### [13.16.4](https://github.com/googleapis/release-please/compare/v13.16.3...v13.16.4) (2022-05-17)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * add release labels if release PR was completed ([#1433](https://github.com/googleapis/release-please/issues/1433)) ([072498c](https://github.com/googleapis/release-please/commit/072498c8ce2f89bc86eb33445d87491e3ab31fbd))
13
+ * CommitSplit with includeEmpty should add commit to all packages ([#1432](https://github.com/googleapis/release-please/issues/1432)) ([19629cb](https://github.com/googleapis/release-please/commit/19629cb42da625d6c62e67f1e9edf7f3cf14d6ee)), closes [#1360](https://github.com/googleapis/release-please/issues/1360)
14
+ * Manifest.fromConfig should find branch component ([#1436](https://github.com/googleapis/release-please/issues/1436)) ([628a562](https://github.com/googleapis/release-please/commit/628a562a21245ed02546aa0c40c97a0e3d50a0c7))
15
+
16
+ ### [13.16.3](https://github.com/googleapis/release-please/compare/v13.16.2...v13.16.3) (2022-05-17)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * add release labels if release PR was completed ([#1433](https://github.com/googleapis/release-please/issues/1433)) ([072498c](https://github.com/googleapis/release-please/commit/072498c8ce2f89bc86eb33445d87491e3ab31fbd))
22
+ * CommitSplit with includeEmpty should add commit to all packages ([#1432](https://github.com/googleapis/release-please/issues/1432)) ([19629cb](https://github.com/googleapis/release-please/commit/19629cb42da625d6c62e67f1e9edf7f3cf14d6ee)), closes [#1360](https://github.com/googleapis/release-please/issues/1360)
23
+ * workspace plugins should update manifest versions ([#1429](https://github.com/googleapis/release-please/issues/1429)) ([ab802a9](https://github.com/googleapis/release-please/commit/ab802a924704044b26017b40a2da48657022faad))
24
+
25
+ ### [13.16.3](https://github.com/googleapis/release-please/compare/v13.16.2...v13.16.3) (2022-05-13)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * workspace plugins should update manifest versions ([#1429](https://github.com/googleapis/release-please/issues/1429)) ([ab802a9](https://github.com/googleapis/release-please/commit/ab802a924704044b26017b40a2da48657022faad))
31
+
7
32
  ### [13.16.3](https://github.com/googleapis/release-please/compare/v13.16.2...v13.16.3) (2022-05-13)
8
33
 
9
34
 
@@ -145,9 +145,9 @@ class Manifest {
145
145
  github,
146
146
  ...config,
147
147
  });
148
- const component = await strategy.getComponent();
148
+ const component = await strategy.getBranchComponent();
149
149
  const releasedVersions = {};
150
- const latestVersion = await latestReleaseVersion(github, targetBranch, version => isPublishedVersion(strategy, version), config.includeComponentInTag ? component : '', config.pullRequestTitlePattern);
150
+ const latestVersion = await latestReleaseVersion(github, targetBranch, version => isPublishedVersion(strategy, version), component, config.pullRequestTitlePattern);
151
151
  if (latestVersion) {
152
152
  releasedVersions[path] = latestVersion;
153
153
  }
@@ -604,20 +604,16 @@ class Manifest {
604
604
  }
605
605
  }
606
606
  async createReleasesForPullRequest(releases, pullRequest) {
607
- // create the release
608
- const promises = [];
609
- for (const release of releases) {
610
- promises.push(this.createRelease(release));
611
- }
607
+ logger_1.logger.info(`Creating ${releases.length} releases for pull #${pullRequest.number}`);
612
608
  const duplicateReleases = [];
613
609
  const githubReleases = [];
614
- for (const promise of promises) {
610
+ for (const release of releases) {
615
611
  try {
616
- githubReleases.push(await promise);
612
+ githubReleases.push(await this.createRelease(release));
617
613
  }
618
614
  catch (err) {
619
615
  if (err instanceof errors_1.DuplicateReleaseError) {
620
- logger_1.logger.warn(`Duplicate release tag: ${err.tag}`);
616
+ logger_1.logger.warn(`Duplicate release tag: ${release.tag.toString()}`);
621
617
  duplicateReleases.push(err);
622
618
  }
623
619
  else {
@@ -625,14 +621,28 @@ class Manifest {
625
621
  }
626
622
  }
627
623
  }
628
- if (duplicateReleases.length > 0 && githubReleases.length === 0) {
629
- throw duplicateReleases[0];
624
+ if (duplicateReleases.length > 0) {
625
+ if (duplicateReleases.length + githubReleases.length ===
626
+ releases.length) {
627
+ // we've either tagged all releases or they were duplicates:
628
+ // adjust tags on pullRequest
629
+ await Promise.all([
630
+ this.github.removeIssueLabels(this.labels, pullRequest.number),
631
+ this.github.addIssueLabels(this.releaseLabels, pullRequest.number),
632
+ ]);
633
+ }
634
+ if (githubReleases.length === 0) {
635
+ // If all releases were duplicate, throw a duplicate error
636
+ throw duplicateReleases[0];
637
+ }
638
+ }
639
+ else {
640
+ // adjust tags on pullRequest
641
+ await Promise.all([
642
+ this.github.removeIssueLabels(this.labels, pullRequest.number),
643
+ this.github.addIssueLabels(this.releaseLabels, pullRequest.number),
644
+ ]);
630
645
  }
631
- // adjust tags on pullRequest
632
- await Promise.all([
633
- this.github.removeIssueLabels(this.labels, pullRequest.number),
634
- this.github.addIssueLabels(this.releaseLabels, pullRequest.number),
635
- ]);
636
646
  return githubReleases;
637
647
  }
638
648
  async createRelease(release) {
@@ -79,7 +79,7 @@ export declare abstract class BaseStrategy implements Strategy {
79
79
  */
80
80
  getComponent(): Promise<string | undefined>;
81
81
  getDefaultComponent(): Promise<string | undefined>;
82
- protected getBranchComponent(): Promise<string | undefined>;
82
+ getBranchComponent(): Promise<string | undefined>;
83
83
  getPackageName(): Promise<string | undefined>;
84
84
  getDefaultPackageName(): Promise<string | undefined>;
85
85
  protected normalizeComponent(component: string | undefined): string;
@@ -36,6 +36,12 @@ export interface Strategy {
36
36
  * @returns {string}
37
37
  */
38
38
  getComponent(): Promise<string | undefined>;
39
+ /**
40
+ * Return the component for this strategy used in the branch name.
41
+ * This may be a computed field.
42
+ * @returns {string}
43
+ */
44
+ getBranchComponent(): Promise<string | undefined>;
39
45
  /**
40
46
  * Validate whether version is a valid release.
41
47
  * @param version Released version.
@@ -3,9 +3,24 @@ export interface CommitSplitOptions {
3
3
  includeEmpty?: boolean;
4
4
  packagePaths?: string[];
5
5
  }
6
+ /**
7
+ * Helper class for splitting commits by component path. If `packagePaths`
8
+ * is configured, then only consider the provided paths. If `includeEmpty`
9
+ * is configured, then commits without any touched files apply to all
10
+ * configured component paths.
11
+ */
6
12
  export declare class CommitSplit {
7
13
  includeEmpty: boolean;
8
14
  packagePaths?: string[];
9
15
  constructor(opts?: CommitSplitOptions);
16
+ /**
17
+ * Split commits by component path. If the commit splitter is configured
18
+ * with a set of tracked package paths, then only consider paths for
19
+ * configured components. If `includeEmpty` is configured, then a commit
20
+ * that does not touch any files will be applied to all components'
21
+ * commits.
22
+ * @param {Commit[]} commits The commits to split
23
+ * @returns {Record<string, Commit[]>} Commits indexed by component path
24
+ */
10
25
  split<T extends Commit>(commits: T[]): Record<string, T[]>;
11
26
  }
@@ -15,6 +15,12 @@
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.CommitSplit = void 0;
17
17
  const manifest_1 = require("../manifest");
18
+ /**
19
+ * Helper class for splitting commits by component path. If `packagePaths`
20
+ * is configured, then only consider the provided paths. If `includeEmpty`
21
+ * is configured, then commits without any touched files apply to all
22
+ * configured component paths.
23
+ */
18
24
  class CommitSplit {
19
25
  constructor(opts) {
20
26
  opts = opts || {};
@@ -50,7 +56,15 @@ class CommitSplit {
50
56
  this.packagePaths = paths;
51
57
  }
52
58
  }
53
- // split(commits: Commit[]): Record<string, Commit[]>
59
+ /**
60
+ * Split commits by component path. If the commit splitter is configured
61
+ * with a set of tracked package paths, then only consider paths for
62
+ * configured components. If `includeEmpty` is configured, then a commit
63
+ * that does not touch any files will be applied to all components'
64
+ * commits.
65
+ * @param {Commit[]} commits The commits to split
66
+ * @returns {Record<string, Commit[]>} Commits indexed by component path
67
+ */
54
68
  split(commits) {
55
69
  const splitCommits = {};
56
70
  commits.forEach(commit => {
@@ -85,8 +99,16 @@ class CommitSplit {
85
99
  splitCommits[pkgName].push(commit);
86
100
  }
87
101
  if (commit.files.length === 0 && this.includeEmpty) {
88
- for (const pkgName in splitCommits) {
89
- splitCommits[pkgName].push(commit);
102
+ if (this.packagePaths) {
103
+ for (const pkgName of this.packagePaths) {
104
+ splitCommits[pkgName] = splitCommits[pkgName] || [];
105
+ splitCommits[pkgName].push(commit);
106
+ }
107
+ }
108
+ else {
109
+ for (const pkgName in splitCommits) {
110
+ splitCommits[pkgName].push(commit);
111
+ }
90
112
  }
91
113
  }
92
114
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-please",
3
- "version": "13.16.3",
3
+ "version": "13.16.4",
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",