release-please 17.9.0 → 17.10.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/README.md +1 -1
- package/build/src/index.d.ts +1 -1
- package/build/src/index.js +1 -1
- package/build/src/manifest.js +22 -20
- package/build/src/strategies/base.js +8 -0
- package/build/src/strategies/go-librarian.d.ts +2 -0
- package/build/src/strategies/go-librarian.js +15 -1
- package/build/src/updaters/librarian-yaml.d.ts +7 -0
- package/build/src/updaters/librarian-yaml.js +47 -21
- package/build/src/util/branch-name.d.ts +1 -0
- package/build/src/util/branch-name.js +9 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# [Release Please](https://github.com/googleapis/release-please)
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.org/package/release-please)
|
|
6
|
-
[](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.
|
package/build/src/index.d.ts
CHANGED
package/build/src/index.js
CHANGED
|
@@ -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.
|
|
39
|
+
exports.VERSION = '17.10.0';
|
|
40
40
|
// x-release-please-end
|
|
41
41
|
//# sourceMappingURL=index.js.map
|
package/build/src/manifest.js
CHANGED
|
@@ -211,26 +211,28 @@ class Manifest {
|
|
|
211
211
|
continue;
|
|
212
212
|
}
|
|
213
213
|
const component = tagName.component || exports.DEFAULT_COMPONENT_NAME;
|
|
214
|
-
const
|
|
215
|
-
if (
|
|
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
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
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.
|
|
798
|
+
if (!this._pathsByComponent[component]) {
|
|
799
|
+
this._pathsByComponent[component] = [];
|
|
798
800
|
}
|
|
799
|
-
this._pathsByComponent[component]
|
|
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
|
|
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,42 @@ class LibrarianYamlUpdater extends default_1.DefaultUpdater {
|
|
|
60
62
|
}
|
|
61
63
|
else {
|
|
62
64
|
// Single version (Go, Python, Node style)
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
this.
|
|
67
|
-
if (
|
|
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.component && libraryJSON.name === this.component);
|
|
76
|
+
const isPythonNodeMatch = this.packagePath &&
|
|
77
|
+
this.deriveOutputDirectory(libraryJSON) === this.packagePath;
|
|
78
|
+
if (isGoMatch || isPythonNodeMatch) {
|
|
79
|
+
newVersion = this.version;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
70
82
|
}
|
|
71
83
|
if (newVersion) {
|
|
72
84
|
const newVersionStr = newVersion.toString();
|
|
73
|
-
if (
|
|
74
|
-
|
|
75
|
-
|
|
85
|
+
if (isPreview) {
|
|
86
|
+
const previewNode = this.getOrCreateSubsection(library, 'preview', doc);
|
|
87
|
+
if (this.updateValue(previewNode, 'version', newVersionStr)) {
|
|
88
|
+
modified = true;
|
|
89
|
+
}
|
|
76
90
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
if (yaml.isMap(java)) {
|
|
88
|
-
if (java.get('released_version') !== newVersionStr) {
|
|
89
|
-
java.set('released_version', newVersionStr);
|
|
91
|
+
else {
|
|
92
|
+
if (this.updateValue(library, 'version', newVersionStr)) {
|
|
93
|
+
modified = true;
|
|
94
|
+
}
|
|
95
|
+
if (this.versionsMap) {
|
|
96
|
+
// Multi-version (Java style): updates released_version for non-SNAPSHOTs
|
|
97
|
+
const isSnapshot = !!((_a = newVersion.preRelease) === null || _a === void 0 ? void 0 : _a.includes('SNAPSHOT'));
|
|
98
|
+
if (!isSnapshot) {
|
|
99
|
+
const javaNode = this.getOrCreateSubsection(library, 'java', doc);
|
|
100
|
+
if (this.updateValue(javaNode, 'released_version', newVersionStr)) {
|
|
90
101
|
modified = true;
|
|
91
102
|
}
|
|
92
103
|
}
|
|
@@ -115,6 +126,21 @@ class LibrarianYamlUpdater extends default_1.DefaultUpdater {
|
|
|
115
126
|
}
|
|
116
127
|
return `google-cloud-${library.name}`;
|
|
117
128
|
}
|
|
129
|
+
getOrCreateSubsection(parent, key, doc) {
|
|
130
|
+
let section = parent.get(key);
|
|
131
|
+
if (!yaml.isMap(section)) {
|
|
132
|
+
section = doc.createNode({});
|
|
133
|
+
parent.set(key, section);
|
|
134
|
+
}
|
|
135
|
+
return section;
|
|
136
|
+
}
|
|
137
|
+
updateValue(node, key, value) {
|
|
138
|
+
if (node.get(key) !== value) {
|
|
139
|
+
node.set(key, value);
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
118
144
|
}
|
|
119
145
|
exports.LibrarianYamlUpdater = LibrarianYamlUpdater;
|
|
120
146
|
//# sourceMappingURL=librarian-yaml.js.map
|
|
@@ -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.
|
|
3
|
+
"version": "17.10.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",
|
|
@@ -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": "^
|
|
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": ">=
|
|
103
|
+
"node": ">=22.0.0"
|
|
104
104
|
},
|
|
105
105
|
"overrides": {
|
|
106
106
|
"tmp": "0.2.6",
|