release-please 17.9.0 → 17.10.1

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/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  # [Release Please](https://github.com/googleapis/release-please)
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/release-please.svg)](https://www.npmjs.org/package/release-please)
6
- [![codecov](https://img.shields.io/codecov/c/github/googleapis/release-please/main.svg?style=flat)](https://codecov.io/gh/googleapis/release-please)
6
+ [![codecov](https://codecov.io/gh/googleapis/release-please/graph/badge.svg)](https://codecov.io/gh/googleapis/release-please)
7
7
 
8
8
  Release Please automates CHANGELOG generation, the creation of GitHub releases,
9
9
  and version bumps for your projects.
@@ -14,4 +14,4 @@ export { Logger, setLogger } from './util/logger';
14
14
  export { GitHub } from './github';
15
15
  export declare const configSchema: any;
16
16
  export declare const manifestSchema: any;
17
- export declare const VERSION = "17.9.0";
17
+ export declare const VERSION = "17.10.1";
@@ -36,6 +36,6 @@ Object.defineProperty(exports, "GitHub", { enumerable: true, get: function () {
36
36
  exports.configSchema = require('../../schemas/config.json');
37
37
  exports.manifestSchema = require('../../schemas/manifest.json');
38
38
  // x-release-please-start-version
39
- exports.VERSION = '17.9.0';
39
+ exports.VERSION = '17.10.1';
40
40
  // x-release-please-end
41
41
  //# sourceMappingURL=index.js.map
@@ -211,26 +211,28 @@ class Manifest {
211
211
  continue;
212
212
  }
213
213
  const component = tagName.component || exports.DEFAULT_COMPONENT_NAME;
214
- const path = pathsByComponent[component];
215
- if (!path) {
214
+ const paths = pathsByComponent[component] || [];
215
+ if (paths.length === 0) {
216
216
  this.logger.warn(`Found release tag with component '${component}', but not configured in manifest`);
217
217
  continue;
218
218
  }
219
- const expectedVersion = this.releasedVersions[path];
220
- if (!expectedVersion) {
221
- this.logger.warn(`Unable to find expected version for path '${path}' in manifest`);
222
- continue;
223
- }
224
- if (expectedVersion.toString() === tagName.version.toString()) {
225
- this.logger.debug(`Found release for path ${path}, ${release.tagName}`);
226
- releaseShasByPath[path] = release.sha;
227
- releasesByPath[path] = {
228
- name: release.name,
229
- tag: tagName,
230
- sha: release.sha,
231
- notes: release.notes || '',
232
- };
233
- releasesFound += 1;
219
+ for (const path of paths) {
220
+ const expectedVersion = this.releasedVersions[path];
221
+ if (!expectedVersion) {
222
+ this.logger.warn(`Unable to find expected version for path '${path}' in manifest`);
223
+ continue;
224
+ }
225
+ if (expectedVersion.toString() === tagName.version.toString()) {
226
+ this.logger.debug(`Found release for path ${path}, ${release.tagName}`);
227
+ releaseShasByPath[path] = release.sha;
228
+ releasesByPath[path] = {
229
+ name: release.name,
230
+ tag: tagName,
231
+ sha: release.sha,
232
+ notes: release.notes || '',
233
+ };
234
+ releasesFound += 1;
235
+ }
234
236
  }
235
237
  if (releasesFound >= expectedReleases) {
236
238
  break;
@@ -793,10 +795,10 @@ class Manifest {
793
795
  for (const path in this.repositoryConfig) {
794
796
  const strategy = strategiesByPath[path];
795
797
  const component = (await strategy.getComponent()) || '';
796
- if (this._pathsByComponent[component]) {
797
- this.logger.warn(`Multiple paths for ${component}: ${this._pathsByComponent[component]}, ${path}`);
798
+ if (!this._pathsByComponent[component]) {
799
+ this._pathsByComponent[component] = [];
798
800
  }
799
- this._pathsByComponent[component] = path;
801
+ this._pathsByComponent[component].push(path);
800
802
  }
801
803
  }
802
804
  return this._pathsByComponent;
@@ -373,6 +373,14 @@ class BaseStrategy {
373
373
  this.logger.error(`Bad branch name: ${mergedPullRequest.headBranchName}`);
374
374
  return;
375
375
  }
376
+ const branchComponent = await this.getBranchComponent();
377
+ if (branchName.isComponent()) {
378
+ if (this.normalizeComponent(branchName.component) !==
379
+ this.normalizeComponent(branchComponent)) {
380
+ this.logger.info(`PR branch component: ${branchName.component} does not match configured branch component: ${branchComponent}`);
381
+ return;
382
+ }
383
+ }
376
384
  const pullRequestBody = await this.parsePullRequestBody(mergedPullRequest.body);
377
385
  if (!pullRequestBody) {
378
386
  this.logger.error('Could not parse pull request body as a release PR');
@@ -4,6 +4,8 @@ import { Version } from '../version';
4
4
  export declare class GoLibrarian extends BaseStrategy {
5
5
  readonly versionFile: string;
6
6
  constructor(options: BaseStrategyOptions);
7
+ getComponent(): Promise<string | undefined>;
8
+ getBranchComponent(): Promise<string | undefined>;
7
9
  protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
8
10
  protected initialReleaseVersion(): Version;
9
11
  }
@@ -26,6 +26,20 @@ class GoLibrarian extends base_1.BaseStrategy {
26
26
  super(options);
27
27
  this.versionFile = (_b = options.versionFile) !== null && _b !== void 0 ? _b : 'internal/version.go';
28
28
  }
29
+ async getComponent() {
30
+ const component = await super.getComponent();
31
+ if (component) {
32
+ const match = component.match(/^(.*)\/v[2-9]\d*$/);
33
+ if (match) {
34
+ return match[1];
35
+ }
36
+ }
37
+ return component;
38
+ }
39
+ async getBranchComponent() {
40
+ const component = await super.getBranchComponent();
41
+ return component ? component.replace(/\//g, '-') : undefined;
42
+ }
29
43
  async buildUpdates(options) {
30
44
  const updates = [];
31
45
  const version = options.newVersion;
@@ -63,7 +77,7 @@ class GoLibrarian extends base_1.BaseStrategy {
63
77
  if (this.initialVersion) {
64
78
  return version_1.Version.parse(this.initialVersion);
65
79
  }
66
- return version_1.Version.parse('1.0.0');
80
+ return version_1.Version.parse('0.1.0');
67
81
  }
68
82
  }
69
83
  exports.GoLibrarian = GoLibrarian;
@@ -4,11 +4,16 @@ export interface JavaModule {
4
4
  artifact_id: string;
5
5
  [key: string]: any;
6
6
  }
7
+ export interface PreviewModule {
8
+ version: string;
9
+ [key: string]: any;
10
+ }
7
11
  export interface LibrarianLibrary {
8
12
  name: string;
9
13
  version: string;
10
14
  output?: string;
11
15
  java?: JavaModule;
16
+ preview?: PreviewModule;
12
17
  [key: string]: any;
13
18
  }
14
19
  export interface LibrarianYamlSchema {
@@ -35,4 +40,6 @@ export declare class LibrarianYamlUpdater extends DefaultUpdater {
35
40
  updateContent(content: string, _logger?: Logger): string;
36
41
  private deriveOutputDirectory;
37
42
  private findArtifactID;
43
+ private getOrCreateSubsection;
44
+ private updateValue;
38
45
  }
@@ -35,6 +35,7 @@ class LibrarianYamlUpdater extends default_1.DefaultUpdater {
35
35
  * @returns {string} The updated content
36
36
  */
37
37
  updateContent(content, _logger = logger_1.logger) {
38
+ var _a;
38
39
  const doc = yaml.parseDocument(content);
39
40
  if (!doc || doc.errors.length > 0) {
40
41
  throw new Error(`Invalid yaml, cannot be parsed: ${doc.errors
@@ -51,6 +52,7 @@ class LibrarianYamlUpdater extends default_1.DefaultUpdater {
51
52
  continue;
52
53
  const libraryJSON = library.toJSON();
53
54
  let newVersion = undefined;
55
+ let isPreview = false;
54
56
  if (this.versionsMap) {
55
57
  // Multi-version (Java style)
56
58
  const artifactID = this.findArtifactID(libraryJSON);
@@ -60,33 +62,44 @@ class LibrarianYamlUpdater extends default_1.DefaultUpdater {
60
62
  }
61
63
  else {
62
64
  // Single version (Go, Python, Node style)
63
- const isGoMatch = (this.packagePath && libraryJSON.name === this.packagePath) ||
64
- (this.component && libraryJSON.name === this.component);
65
- const isPythonNodeMatch = this.packagePath &&
66
- this.deriveOutputDirectory(libraryJSON) === this.packagePath;
67
- if (isGoMatch || isPythonNodeMatch) {
65
+ const isGoPreviewMatch = this.packagePath &&
66
+ this.packagePath === `preview/internal/${libraryJSON.name}`;
67
+ const isPythonPreviewMatch = this.packagePath &&
68
+ this.packagePath === `preview-packages/${libraryJSON.name}`;
69
+ if (isGoPreviewMatch || isPythonPreviewMatch) {
70
+ isPreview = true;
68
71
  newVersion = this.version;
69
72
  }
73
+ else {
74
+ const isGoMatch = (this.packagePath && libraryJSON.name === this.packagePath) ||
75
+ ((!this.packagePath || this.packagePath === '.') &&
76
+ this.component &&
77
+ libraryJSON.name === this.component);
78
+ const isPythonNodeMatch = this.packagePath &&
79
+ this.deriveOutputDirectory(libraryJSON) === this.packagePath;
80
+ if (isGoMatch || isPythonNodeMatch) {
81
+ newVersion = this.version;
82
+ }
83
+ }
70
84
  }
71
85
  if (newVersion) {
72
86
  const newVersionStr = newVersion.toString();
73
- if (library.get('version') !== newVersionStr) {
74
- library.set('version', newVersionStr);
75
- modified = true;
87
+ if (isPreview) {
88
+ const previewNode = this.getOrCreateSubsection(library, 'preview', doc);
89
+ if (this.updateValue(previewNode, 'version', newVersionStr)) {
90
+ modified = true;
91
+ }
76
92
  }
77
- if (this.versionsMap) {
78
- const isSnapshot = newVersion.preRelease === 'SNAPSHOT';
79
- if (!isSnapshot) {
80
- let java = library.get('java');
81
- if (!yaml.isMap(java)) {
82
- const javaNode = doc.createNode({});
83
- library.set('java', javaNode);
84
- java = javaNode;
85
- modified = true;
86
- }
87
- if (yaml.isMap(java)) {
88
- if (java.get('released_version') !== newVersionStr) {
89
- java.set('released_version', newVersionStr);
93
+ else {
94
+ if (this.updateValue(library, 'version', newVersionStr)) {
95
+ modified = true;
96
+ }
97
+ if (this.versionsMap) {
98
+ // Multi-version (Java style): updates released_version for non-SNAPSHOTs
99
+ const isSnapshot = !!((_a = newVersion.preRelease) === null || _a === void 0 ? void 0 : _a.includes('SNAPSHOT'));
100
+ if (!isSnapshot) {
101
+ const javaNode = this.getOrCreateSubsection(library, 'java', doc);
102
+ if (this.updateValue(javaNode, 'released_version', newVersionStr)) {
90
103
  modified = true;
91
104
  }
92
105
  }
@@ -115,6 +128,21 @@ class LibrarianYamlUpdater extends default_1.DefaultUpdater {
115
128
  }
116
129
  return `google-cloud-${library.name}`;
117
130
  }
131
+ getOrCreateSubsection(parent, key, doc) {
132
+ let section = parent.get(key);
133
+ if (!yaml.isMap(section)) {
134
+ section = doc.createNode({});
135
+ parent.set(key, section);
136
+ }
137
+ return section;
138
+ }
139
+ updateValue(node, key, value) {
140
+ if (node.get(key) !== value) {
141
+ node.set(key, value);
142
+ return true;
143
+ }
144
+ return false;
145
+ }
118
146
  }
119
147
  exports.LibrarianYamlUpdater = LibrarianYamlUpdater;
120
148
  //# sourceMappingURL=librarian-yaml.js.map
@@ -16,4 +16,5 @@ export declare class BranchName {
16
16
  getComponent(): string | undefined;
17
17
  getVersion(): Version | undefined;
18
18
  toString(): string;
19
+ isComponent(): boolean;
19
20
  }
@@ -78,6 +78,9 @@ class BranchName {
78
78
  toString() {
79
79
  return '';
80
80
  }
81
+ isComponent() {
82
+ return false;
83
+ }
81
84
  }
82
85
  exports.BranchName = BranchName;
83
86
  /**
@@ -156,6 +159,9 @@ class V12ComponentBranchName extends BranchName {
156
159
  toString() {
157
160
  return `${RELEASE_PLEASE}/branches/${this.targetBranch}/components/${this.component}`;
158
161
  }
162
+ isComponent() {
163
+ return true;
164
+ }
159
165
  }
160
166
  const DEFAULT_PATTERN = `^${RELEASE_PLEASE}--branches--(?<branch>.+)$`;
161
167
  class DefaultBranchName extends BranchName {
@@ -189,6 +195,9 @@ class ComponentBranchName extends BranchName {
189
195
  toString() {
190
196
  return `${RELEASE_PLEASE}--branches--${this.targetBranch}--components--${this.component}`;
191
197
  }
198
+ isComponent() {
199
+ return true;
200
+ }
192
201
  }
193
202
  const GROUP_PATTERN = `^${RELEASE_PLEASE}--branches--(?<branch>.+)--groups--(?<group>.+)$`;
194
203
  class GroupBranchName extends BranchName {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-please",
3
- "version": "17.9.0",
3
+ "version": "17.10.1",
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",
@@ -47,7 +47,7 @@
47
47
  "@types/js-yaml": "^4.0.0",
48
48
  "@types/jsonpath": "^0.2.0",
49
49
  "@types/mocha": "^10.0.0",
50
- "@types/node": "^18.0.0",
50
+ "@types/node": "^22.0.0",
51
51
  "@types/npmlog": "^7.0.0",
52
52
  "@types/semver": "^7.0.0",
53
53
  "@types/sinon": "^17.0.0",
@@ -100,7 +100,7 @@
100
100
  "yargs": "^17.0.0"
101
101
  },
102
102
  "engines": {
103
- "node": ">=20.0.0"
103
+ "node": ">=22.0.0"
104
104
  },
105
105
  "overrides": {
106
106
  "tmp": "0.2.6",