release-please 13.4.14 → 13.6.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 +28 -0
- package/build/src/bin/release-please.js +12 -1
- package/build/src/factory.js +9 -0
- package/build/src/manifest.d.ts +19 -2
- package/build/src/manifest.js +39 -40
- package/build/src/plugin.d.ts +10 -1
- package/build/src/plugin.js +16 -0
- package/build/src/plugins/linked-versions.d.ts +29 -0
- package/build/src/plugins/linked-versions.js +125 -0
- package/build/src/strategies/base.d.ts +3 -2
- package/build/src/strategies/base.js +27 -6
- package/build/src/strategies/java-yoshi.js +5 -2
- package/build/src/strategies/ocaml.js +10 -0
- package/build/src/updaters/generic-json.d.ts +13 -0
- package/build/src/updaters/generic-json.js +43 -0
- package/build/src/updaters/generic-xml.d.ts +13 -0
- package/build/src/updaters/generic-xml.js +47 -0
- package/build/src/versioning-strategies/dependency-manifest.js +1 -1
- package/package.json +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,34 @@
|
|
|
4
4
|
|
|
5
5
|
[1]: https://www.npmjs.com/package/release-please?activeTab=versions
|
|
6
6
|
|
|
7
|
+
## [13.6.0](https://github.com/googleapis/release-please/compare/v13.5.0...v13.6.0) (2022-03-16)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* add linked-versions plugin for grouping components ([#1327](https://github.com/googleapis/release-please/issues/1327)) ([f398bdf](https://github.com/googleapis/release-please/commit/f398bdffdae69772c61a82cd7158cca3478c2110))
|
|
13
|
+
* introduce generic json updater ([#1332](https://github.com/googleapis/release-please/issues/1332)) ([ecbfcf0](https://github.com/googleapis/release-please/commit/ecbfcf03f7854ced3ace5eafd95f7872ddee1d14))
|
|
14
|
+
* introduce generic xml updater ([#1337](https://github.com/googleapis/release-please/issues/1337)) ([02ef78b](https://github.com/googleapis/release-please/commit/02ef78b4d6a855236ff80fc139fd00a46f88d445))
|
|
15
|
+
|
|
16
|
+
## [13.5.0](https://github.com/googleapis/release-please/compare/v13.4.15...v13.5.0) (2022-03-08)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* **ocaml:** update opam `project.opam.locked` files ([#1325](https://github.com/googleapis/release-please/issues/1325)) ([858199e](https://github.com/googleapis/release-please/commit/858199e4fac71ce2574c4195b85dc4e8bf26e0f7))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
* fix regex for parsing major version update ([#1330](https://github.com/googleapis/release-please/issues/1330)) ([afadec9](https://github.com/googleapis/release-please/commit/afadec95aa62aa32372512455326c4cdf8943f70))
|
|
27
|
+
|
|
28
|
+
### [13.4.15](https://github.com/googleapis/release-please/compare/v13.4.14...v13.4.15) (2022-03-02)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* tagging many GitHub releases should not require a file touched check ([#1321](https://github.com/googleapis/release-please/issues/1321)) ([ab99242](https://github.com/googleapis/release-please/commit/ab9924215e68838e6ec62d283b5712cbff6e6a4c))
|
|
34
|
+
|
|
7
35
|
### [13.4.14](https://github.com/googleapis/release-please/compare/v13.4.13...v13.4.14) (2022-03-01)
|
|
8
36
|
|
|
9
37
|
|
|
@@ -332,7 +332,18 @@ const createReleaseCommand = {
|
|
|
332
332
|
}
|
|
333
333
|
if (argv.dryRun) {
|
|
334
334
|
const releases = await manifest.buildReleases();
|
|
335
|
-
logger_1.logger.info(releases);
|
|
335
|
+
logger_1.logger.info(`Would tag ${releases.length} releases:`);
|
|
336
|
+
for (const release of releases) {
|
|
337
|
+
logger_1.logger.info({
|
|
338
|
+
name: release.name,
|
|
339
|
+
tag: release.tag.toString(),
|
|
340
|
+
notes: release.notes,
|
|
341
|
+
sha: release.sha,
|
|
342
|
+
draft: release.draft,
|
|
343
|
+
prerelease: release.prerelease,
|
|
344
|
+
pullNumber: release.pullRequest.number,
|
|
345
|
+
});
|
|
346
|
+
}
|
|
336
347
|
}
|
|
337
348
|
else {
|
|
338
349
|
const releaseNumbers = await manifest.createReleases();
|
package/build/src/factory.js
CHANGED
|
@@ -39,6 +39,7 @@ const node_workspace_1 = require("./plugins/node-workspace");
|
|
|
39
39
|
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
|
+
const linked_versions_1 = require("./plugins/linked-versions");
|
|
42
43
|
// Factory shared by GitHub Action and CLI for creating Release PRs
|
|
43
44
|
// and GitHub Releases:
|
|
44
45
|
// add any new releasers you create to this type as well as the `releasers`
|
|
@@ -191,6 +192,14 @@ function buildVersioningStrategy(options) {
|
|
|
191
192
|
}
|
|
192
193
|
}
|
|
193
194
|
function buildPlugin(options) {
|
|
195
|
+
if (typeof options.type === 'object') {
|
|
196
|
+
switch (options.type.type) {
|
|
197
|
+
case 'linked-versions':
|
|
198
|
+
return new linked_versions_1.LinkedVersions(options.github, options.targetBranch, options.repositoryConfig, options.type.groupName, options.type.components);
|
|
199
|
+
default:
|
|
200
|
+
throw new Error(`Unknown plugin type: ${options.type}`);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
194
203
|
switch (options.type) {
|
|
195
204
|
case 'cargo-workspace':
|
|
196
205
|
return new cargo_workspace_1.CargoWorkspace(options.github, options.targetBranch, options.repositoryConfig, options);
|
package/build/src/manifest.d.ts
CHANGED
|
@@ -5,6 +5,17 @@ import { PullRequest } from './pull-request';
|
|
|
5
5
|
import { ReleasePullRequest } from './release-pull-request';
|
|
6
6
|
import { ReleaseType, VersioningStrategyType, ChangelogNotesType } from './factory';
|
|
7
7
|
import { Release } from './release';
|
|
8
|
+
declare type ExtraJsonFile = {
|
|
9
|
+
type: 'json';
|
|
10
|
+
path: string;
|
|
11
|
+
jsonpath: string;
|
|
12
|
+
};
|
|
13
|
+
declare type ExtraXmlFile = {
|
|
14
|
+
type: 'xml';
|
|
15
|
+
path: string;
|
|
16
|
+
xpath: string;
|
|
17
|
+
};
|
|
18
|
+
export declare type ExtraFile = string | ExtraJsonFile | ExtraXmlFile;
|
|
8
19
|
/**
|
|
9
20
|
* These are configurations provided to each strategy per-path.
|
|
10
21
|
*/
|
|
@@ -27,7 +38,7 @@ export interface ReleaserConfig {
|
|
|
27
38
|
changelogPath?: string;
|
|
28
39
|
changelogType?: ChangelogNotesType;
|
|
29
40
|
versionFile?: string;
|
|
30
|
-
extraFiles?:
|
|
41
|
+
extraFiles?: ExtraFile[];
|
|
31
42
|
}
|
|
32
43
|
export interface CandidateReleasePullRequest {
|
|
33
44
|
path: string;
|
|
@@ -80,7 +91,13 @@ interface ReleaserPackageConfig extends ReleaserConfigJson {
|
|
|
80
91
|
component?: string;
|
|
81
92
|
'changelog-path'?: string;
|
|
82
93
|
}
|
|
83
|
-
|
|
94
|
+
declare type DirectPluginType = 'node-workspace' | 'cargo-workspace';
|
|
95
|
+
interface LinkedVersionPluginConfig {
|
|
96
|
+
type: 'linked-versions';
|
|
97
|
+
groupName: string;
|
|
98
|
+
components: string[];
|
|
99
|
+
}
|
|
100
|
+
export declare type PluginType = DirectPluginType | LinkedVersionPluginConfig;
|
|
84
101
|
/**
|
|
85
102
|
* This is the schema of the manifest config json
|
|
86
103
|
*/
|
package/build/src/manifest.js
CHANGED
|
@@ -270,33 +270,54 @@ class Manifest {
|
|
|
270
270
|
includeEmpty: true,
|
|
271
271
|
packagePaths: Object.keys(this.repositoryConfig),
|
|
272
272
|
});
|
|
273
|
-
const
|
|
274
|
-
|
|
273
|
+
const splitCommits = cs.split(commits);
|
|
274
|
+
// limit paths to ones since the last release
|
|
275
|
+
const commitsPerPath = {};
|
|
275
276
|
for (const path in this.repositoryConfig) {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
const
|
|
281
|
-
logger_1.logger.debug(`commits: ${pathCommits.length}`);
|
|
282
|
-
const latestReleasePullRequest = releasePullRequestsBySha[releaseShasByPath[path]];
|
|
283
|
-
if (!latestReleasePullRequest) {
|
|
284
|
-
logger_1.logger.warn('No latest release pull request found.');
|
|
285
|
-
}
|
|
286
|
-
const strategy = strategiesByPath[path];
|
|
287
|
-
let latestRelease = releasesByPath[path];
|
|
277
|
+
commitsPerPath[path] = commitsAfterSha(path === exports.ROOT_PROJECT_PATH ? commits : splitCommits[path], releaseShasByPath[path]);
|
|
278
|
+
}
|
|
279
|
+
// backfill latest release tags from manifest
|
|
280
|
+
for (const path in this.repositoryConfig) {
|
|
281
|
+
const latestRelease = releasesByPath[path];
|
|
288
282
|
if (!latestRelease &&
|
|
289
283
|
this.releasedVersions[path] &&
|
|
290
284
|
this.releasedVersions[path].toString() !== '0.0.0') {
|
|
291
285
|
const version = this.releasedVersions[path];
|
|
286
|
+
const strategy = strategiesByPath[path];
|
|
292
287
|
const component = await strategy.getComponent();
|
|
293
288
|
logger_1.logger.info(`No latest release found for path: ${path}, component: ${component}, but a previous version (${version.toString()}) was specified in the manifest.`);
|
|
294
|
-
|
|
289
|
+
releasesByPath[path] = {
|
|
295
290
|
tag: new tag_name_1.TagName(version, component),
|
|
296
291
|
sha: '',
|
|
297
292
|
notes: '',
|
|
298
293
|
};
|
|
299
294
|
}
|
|
295
|
+
}
|
|
296
|
+
// Build plugins
|
|
297
|
+
const plugins = this.plugins.map(pluginType => factory_1.buildPlugin({
|
|
298
|
+
type: pluginType,
|
|
299
|
+
github: this.github,
|
|
300
|
+
targetBranch: this.targetBranch,
|
|
301
|
+
repositoryConfig: this.repositoryConfig,
|
|
302
|
+
}));
|
|
303
|
+
let strategies = strategiesByPath;
|
|
304
|
+
for (const plugin of plugins) {
|
|
305
|
+
strategies = await plugin.preconfigure(strategies, commitsPerPath, releasesByPath);
|
|
306
|
+
}
|
|
307
|
+
let newReleasePullRequests = [];
|
|
308
|
+
for (const path in this.repositoryConfig) {
|
|
309
|
+
const config = this.repositoryConfig[path];
|
|
310
|
+
logger_1.logger.info(`Building candidate release pull request for path: ${path}`);
|
|
311
|
+
logger_1.logger.debug(`type: ${config.releaseType}`);
|
|
312
|
+
logger_1.logger.debug(`targetBranch: ${this.targetBranch}`);
|
|
313
|
+
const pathCommits = commitsPerPath[path];
|
|
314
|
+
logger_1.logger.debug(`commits: ${pathCommits.length}`);
|
|
315
|
+
const latestReleasePullRequest = releasePullRequestsBySha[releaseShasByPath[path]];
|
|
316
|
+
if (!latestReleasePullRequest) {
|
|
317
|
+
logger_1.logger.warn('No latest release pull request found.');
|
|
318
|
+
}
|
|
319
|
+
const strategy = strategies[path];
|
|
320
|
+
const latestRelease = releasesByPath[path];
|
|
300
321
|
const releasePullRequest = await strategy.buildReleasePullRequest(pathCommits, latestRelease, (_a = config.draftPullRequest) !== null && _a !== void 0 ? _a : this.draftPullRequest, this.labels);
|
|
301
322
|
if (releasePullRequest) {
|
|
302
323
|
if (releasePullRequest.version) {
|
|
@@ -318,13 +339,6 @@ class Manifest {
|
|
|
318
339
|
});
|
|
319
340
|
}
|
|
320
341
|
}
|
|
321
|
-
// Build plugins
|
|
322
|
-
const plugins = this.plugins.map(pluginType => factory_1.buildPlugin({
|
|
323
|
-
type: pluginType,
|
|
324
|
-
github: this.github,
|
|
325
|
-
targetBranch: this.targetBranch,
|
|
326
|
-
repositoryConfig: this.repositoryConfig,
|
|
327
|
-
}));
|
|
328
342
|
// Combine pull requests into 1 unless configured for separate
|
|
329
343
|
// pull requests
|
|
330
344
|
if (!this.separatePullRequests) {
|
|
@@ -454,29 +468,11 @@ class Manifest {
|
|
|
454
468
|
const generator = await this.findMergedReleasePullRequests();
|
|
455
469
|
const releases = [];
|
|
456
470
|
for await (const pullRequest of generator) {
|
|
457
|
-
logger_1.logger.info('Looking at files touched by path');
|
|
458
|
-
const cs = new commit_split_1.CommitSplit({
|
|
459
|
-
includeEmpty: true,
|
|
460
|
-
packagePaths: Object.keys(this.repositoryConfig),
|
|
461
|
-
});
|
|
462
|
-
const commits = [
|
|
463
|
-
{
|
|
464
|
-
sha: pullRequest.sha,
|
|
465
|
-
message: pullRequest.title,
|
|
466
|
-
files: pullRequest.files,
|
|
467
|
-
},
|
|
468
|
-
];
|
|
469
|
-
const commitsPerPath = cs.split(commits);
|
|
470
471
|
for (const path in this.repositoryConfig) {
|
|
471
472
|
const config = this.repositoryConfig[path];
|
|
472
473
|
logger_1.logger.info(`Building release for path: ${path}`);
|
|
473
474
|
logger_1.logger.debug(`type: ${config.releaseType}`);
|
|
474
475
|
logger_1.logger.debug(`targetBranch: ${this.targetBranch}`);
|
|
475
|
-
const pathCommits = path === exports.ROOT_PROJECT_PATH ? commits : commitsPerPath[path];
|
|
476
|
-
if (!pathCommits || pathCommits.length === 0) {
|
|
477
|
-
logger_1.logger.info(`No commits for path: ${path}, skipping`);
|
|
478
|
-
continue;
|
|
479
|
-
}
|
|
480
476
|
const strategy = strategiesByPath[path];
|
|
481
477
|
const release = await strategy.buildRelease(pullRequest);
|
|
482
478
|
if (release) {
|
|
@@ -490,6 +486,9 @@ class Manifest {
|
|
|
490
486
|
release.tag.version.major === 0),
|
|
491
487
|
});
|
|
492
488
|
}
|
|
489
|
+
else {
|
|
490
|
+
logger_1.logger.info(`No release necessary for path: ${path}`);
|
|
491
|
+
}
|
|
493
492
|
}
|
|
494
493
|
}
|
|
495
494
|
return releases;
|
package/build/src/plugin.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { GitHub } from './github';
|
|
2
2
|
import { CandidateReleasePullRequest, RepositoryConfig } from './manifest';
|
|
3
|
+
import { Strategy } from './strategy';
|
|
4
|
+
import { Commit } from './commit';
|
|
5
|
+
import { Release } from './release';
|
|
3
6
|
/**
|
|
4
7
|
* A plugin runs after a repository manifest has built candidate
|
|
5
8
|
* pull requests and can make updates that span across multiple
|
|
@@ -16,5 +19,11 @@ export declare abstract class ManifestPlugin {
|
|
|
16
19
|
* @param {CandidateReleasePullRequest[]} pullRequests Candidate pull requests
|
|
17
20
|
* @returns {CandidateReleasePullRequest[]} Updated pull requests
|
|
18
21
|
*/
|
|
19
|
-
|
|
22
|
+
run(pullRequests: CandidateReleasePullRequest[]): Promise<CandidateReleasePullRequest[]>;
|
|
23
|
+
/**
|
|
24
|
+
* Pre-configure strategies.
|
|
25
|
+
* @param {Record<string, Strategy>} strategiesByPath Strategies indexed by path
|
|
26
|
+
* @returns {Record<string, Strategy>} Updated strategies indexed by path
|
|
27
|
+
*/
|
|
28
|
+
preconfigure(strategiesByPath: Record<string, Strategy>, _commitsByPath: Record<string, Commit[]>, _releasesByPath: Record<string, Release>): Promise<Record<string, Strategy>>;
|
|
20
29
|
}
|
package/build/src/plugin.js
CHANGED
|
@@ -26,6 +26,22 @@ class ManifestPlugin {
|
|
|
26
26
|
this.targetBranch = targetBranch;
|
|
27
27
|
this.repositoryConfig = repositoryConfig;
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Post-process candidate pull requests.
|
|
31
|
+
* @param {CandidateReleasePullRequest[]} pullRequests Candidate pull requests
|
|
32
|
+
* @returns {CandidateReleasePullRequest[]} Updated pull requests
|
|
33
|
+
*/
|
|
34
|
+
async run(pullRequests) {
|
|
35
|
+
return pullRequests;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Pre-configure strategies.
|
|
39
|
+
* @param {Record<string, Strategy>} strategiesByPath Strategies indexed by path
|
|
40
|
+
* @returns {Record<string, Strategy>} Updated strategies indexed by path
|
|
41
|
+
*/
|
|
42
|
+
async preconfigure(strategiesByPath, _commitsByPath, _releasesByPath) {
|
|
43
|
+
return strategiesByPath;
|
|
44
|
+
}
|
|
29
45
|
}
|
|
30
46
|
exports.ManifestPlugin = ManifestPlugin;
|
|
31
47
|
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ManifestPlugin } from '../plugin';
|
|
2
|
+
import { RepositoryConfig, CandidateReleasePullRequest } from '../manifest';
|
|
3
|
+
import { GitHub } from '../github';
|
|
4
|
+
import { Strategy } from '../strategy';
|
|
5
|
+
import { Commit } from '../commit';
|
|
6
|
+
import { Release } from '../release';
|
|
7
|
+
/**
|
|
8
|
+
* This plugin reconfigures strategies by linking multiple components
|
|
9
|
+
* together.
|
|
10
|
+
*
|
|
11
|
+
* Release notes are broken up using `<summary>`/`<details>` blocks.
|
|
12
|
+
*/
|
|
13
|
+
export declare class LinkedVersions extends ManifestPlugin {
|
|
14
|
+
private groupName;
|
|
15
|
+
private components;
|
|
16
|
+
constructor(github: GitHub, targetBranch: string, repositoryConfig: RepositoryConfig, groupName: string, components: string[]);
|
|
17
|
+
/**
|
|
18
|
+
* Pre-configure strategies.
|
|
19
|
+
* @param {Record<string, Strategy>} strategiesByPath Strategies indexed by path
|
|
20
|
+
* @returns {Record<string, Strategy>} Updated strategies indexed by path
|
|
21
|
+
*/
|
|
22
|
+
preconfigure(strategiesByPath: Record<string, Strategy>, commitsByPath: Record<string, Commit[]>, releasesByPath: Record<string, Release>): Promise<Record<string, Strategy>>;
|
|
23
|
+
/**
|
|
24
|
+
* Post-process candidate pull requests.
|
|
25
|
+
* @param {CandidateReleasePullRequest[]} pullRequests Candidate pull requests
|
|
26
|
+
* @returns {CandidateReleasePullRequest[]} Updated pull requests
|
|
27
|
+
*/
|
|
28
|
+
run(candidates: CandidateReleasePullRequest[]): Promise<CandidateReleasePullRequest[]>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2022 Google LLC
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.LinkedVersions = void 0;
|
|
17
|
+
const plugin_1 = require("../plugin");
|
|
18
|
+
const logger_1 = require("../util/logger");
|
|
19
|
+
const factory_1 = require("../factory");
|
|
20
|
+
const merge_1 = require("./merge");
|
|
21
|
+
/**
|
|
22
|
+
* This plugin reconfigures strategies by linking multiple components
|
|
23
|
+
* together.
|
|
24
|
+
*
|
|
25
|
+
* Release notes are broken up using `<summary>`/`<details>` blocks.
|
|
26
|
+
*/
|
|
27
|
+
class LinkedVersions extends plugin_1.ManifestPlugin {
|
|
28
|
+
constructor(github, targetBranch, repositoryConfig, groupName, components) {
|
|
29
|
+
super(github, targetBranch, repositoryConfig);
|
|
30
|
+
this.groupName = groupName;
|
|
31
|
+
this.components = new Set(components);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Pre-configure strategies.
|
|
35
|
+
* @param {Record<string, Strategy>} strategiesByPath Strategies indexed by path
|
|
36
|
+
* @returns {Record<string, Strategy>} Updated strategies indexed by path
|
|
37
|
+
*/
|
|
38
|
+
async preconfigure(strategiesByPath, commitsByPath, releasesByPath) {
|
|
39
|
+
// Find all strategies in the group
|
|
40
|
+
const groupStrategies = {};
|
|
41
|
+
for (const path in strategiesByPath) {
|
|
42
|
+
const strategy = strategiesByPath[path];
|
|
43
|
+
const component = await strategy.getComponent();
|
|
44
|
+
if (!component) {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
if (this.components.has(component)) {
|
|
48
|
+
groupStrategies[path] = strategy;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
logger_1.logger.info(`Found ${Object.keys(groupStrategies).length} group components for ${this.groupName}`);
|
|
52
|
+
const groupVersions = {};
|
|
53
|
+
const missingReleasePaths = new Set();
|
|
54
|
+
for (const path in groupStrategies) {
|
|
55
|
+
const strategy = groupStrategies[path];
|
|
56
|
+
const latestRelease = releasesByPath[path];
|
|
57
|
+
const releasePullRequest = await strategy.buildReleasePullRequest(commitsByPath[path], latestRelease);
|
|
58
|
+
if (releasePullRequest === null || releasePullRequest === void 0 ? void 0 : releasePullRequest.version) {
|
|
59
|
+
groupVersions[path] = releasePullRequest.version;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
missingReleasePaths.add(path);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const versions = Object.values(groupVersions);
|
|
66
|
+
if (versions.length === 0) {
|
|
67
|
+
return strategiesByPath;
|
|
68
|
+
}
|
|
69
|
+
const primaryVersion = versions.reduce((collector, version) => collector.compare(version) > 0 ? collector : version, versions[0]);
|
|
70
|
+
const newStrategies = {};
|
|
71
|
+
for (const path in strategiesByPath) {
|
|
72
|
+
if (path in groupStrategies) {
|
|
73
|
+
const component = await strategiesByPath[path].getComponent();
|
|
74
|
+
logger_1.logger.info(`Replacing strategy for path ${path} with forced version: ${primaryVersion}`);
|
|
75
|
+
newStrategies[path] = await factory_1.buildStrategy({
|
|
76
|
+
...this.repositoryConfig[path],
|
|
77
|
+
github: this.github,
|
|
78
|
+
path,
|
|
79
|
+
targetBranch: this.targetBranch,
|
|
80
|
+
releaseAs: primaryVersion.toString(),
|
|
81
|
+
});
|
|
82
|
+
if (missingReleasePaths.has(path)) {
|
|
83
|
+
logger_1.logger.debug(`Appending fake commit for path: ${path}`);
|
|
84
|
+
commitsByPath[path].push({
|
|
85
|
+
sha: '',
|
|
86
|
+
message: `chore(${component}): Synchronize ${this.groupName} versions\n\nRelease-As: ${primaryVersion.toString()}`,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
newStrategies[path] = strategiesByPath[path];
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return newStrategies;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Post-process candidate pull requests.
|
|
98
|
+
* @param {CandidateReleasePullRequest[]} pullRequests Candidate pull requests
|
|
99
|
+
* @returns {CandidateReleasePullRequest[]} Updated pull requests
|
|
100
|
+
*/
|
|
101
|
+
async run(candidates) {
|
|
102
|
+
const [inScopeCandidates, outOfScopeCandidates] = candidates.reduce((collection, candidate) => {
|
|
103
|
+
if (!candidate.pullRequest.version) {
|
|
104
|
+
logger_1.logger.warn('pull request missing version', candidate);
|
|
105
|
+
return collection;
|
|
106
|
+
}
|
|
107
|
+
if (this.components.has(candidate.config.component || '')) {
|
|
108
|
+
collection[0].push(candidate);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
collection[1].push(candidate);
|
|
112
|
+
}
|
|
113
|
+
return collection;
|
|
114
|
+
}, [[], []]);
|
|
115
|
+
// delegate to the merge plugin and add merged pull request
|
|
116
|
+
if (inScopeCandidates.length > 0) {
|
|
117
|
+
const merge = new merge_1.Merge(this.github, this.targetBranch, this.repositoryConfig, `chore\${branch}: release ${this.groupName} libraries`);
|
|
118
|
+
const merged = await merge.run(inScopeCandidates);
|
|
119
|
+
outOfScopeCandidates.push(...merged);
|
|
120
|
+
}
|
|
121
|
+
return outOfScopeCandidates;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
exports.LinkedVersions = LinkedVersions;
|
|
125
|
+
//# sourceMappingURL=linked-versions.js.map
|
|
@@ -3,6 +3,7 @@ import { GitHub } from '../github';
|
|
|
3
3
|
import { VersioningStrategy } from '../versioning-strategy';
|
|
4
4
|
import { Repository } from '../repository';
|
|
5
5
|
import { ChangelogNotes, ChangelogSection } from '../changelog-notes';
|
|
6
|
+
import { ExtraFile } from '../manifest';
|
|
6
7
|
import { Update } from '../update';
|
|
7
8
|
import { ConventionalCommit, Commit } from '../commit';
|
|
8
9
|
import { Version, VersionsMap } from '../version';
|
|
@@ -37,7 +38,7 @@ export interface BaseStrategyOptions {
|
|
|
37
38
|
changelogNotes?: ChangelogNotes;
|
|
38
39
|
includeComponentInTag?: boolean;
|
|
39
40
|
pullRequestTitlePattern?: string;
|
|
40
|
-
extraFiles?:
|
|
41
|
+
extraFiles?: ExtraFile[];
|
|
41
42
|
}
|
|
42
43
|
/**
|
|
43
44
|
* A strategy is responsible for determining which files are
|
|
@@ -57,7 +58,7 @@ export declare abstract class BaseStrategy implements Strategy {
|
|
|
57
58
|
private releaseAs?;
|
|
58
59
|
protected includeComponentInTag: boolean;
|
|
59
60
|
private pullRequestTitlePattern?;
|
|
60
|
-
readonly extraFiles:
|
|
61
|
+
readonly extraFiles: ExtraFile[];
|
|
61
62
|
readonly changelogNotes: ChangelogNotes;
|
|
62
63
|
protected changelogSections?: ChangelogSection[];
|
|
63
64
|
constructor(options: BaseStrategyOptions);
|
|
@@ -26,6 +26,8 @@ const branch_name_1 = require("../util/branch-name");
|
|
|
26
26
|
const pull_request_body_1 = require("../util/pull-request-body");
|
|
27
27
|
const composite_1 = require("../updaters/composite");
|
|
28
28
|
const generic_1 = require("../updaters/generic");
|
|
29
|
+
const generic_json_1 = require("../updaters/generic-json");
|
|
30
|
+
const generic_xml_1 = require("../updaters/generic-xml");
|
|
29
31
|
const DEFAULT_CHANGELOG_PATH = 'CHANGELOG.md';
|
|
30
32
|
/**
|
|
31
33
|
* A strategy is responsible for determining which files are
|
|
@@ -163,12 +165,31 @@ class BaseStrategy {
|
|
|
163
165
|
};
|
|
164
166
|
}
|
|
165
167
|
extraFileUpdates(version) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
168
|
+
return this.extraFiles.map(extraFile => {
|
|
169
|
+
if (typeof extraFile === 'object') {
|
|
170
|
+
switch (extraFile.type) {
|
|
171
|
+
case 'json':
|
|
172
|
+
return {
|
|
173
|
+
path: this.addPath(extraFile.path),
|
|
174
|
+
createIfMissing: false,
|
|
175
|
+
updater: new generic_json_1.GenericJson(extraFile.jsonpath, version),
|
|
176
|
+
};
|
|
177
|
+
case 'xml':
|
|
178
|
+
return {
|
|
179
|
+
path: this.addPath(extraFile.path),
|
|
180
|
+
createIfMissing: false,
|
|
181
|
+
updater: new generic_xml_1.GenericXml(extraFile.xpath, version),
|
|
182
|
+
};
|
|
183
|
+
default:
|
|
184
|
+
throw new Error(`unsupported extraFile type: ${extraFile.type}`);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return {
|
|
188
|
+
path: this.addPath(extraFile),
|
|
189
|
+
createIfMissing: false,
|
|
190
|
+
updater: new generic_1.Generic({ version }),
|
|
191
|
+
};
|
|
192
|
+
});
|
|
172
193
|
}
|
|
173
194
|
changelogEmpty(changelogEntry) {
|
|
174
195
|
return changelogEntry.split('\n').length <= 1;
|
|
@@ -198,9 +198,12 @@ class JavaYoshi extends base_1.BaseStrategy {
|
|
|
198
198
|
}),
|
|
199
199
|
});
|
|
200
200
|
});
|
|
201
|
-
this.extraFiles.forEach(
|
|
201
|
+
this.extraFiles.forEach(extraFile => {
|
|
202
|
+
if (typeof extraFile === 'object') {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
202
205
|
updates.push({
|
|
203
|
-
path,
|
|
206
|
+
path: extraFile,
|
|
204
207
|
createIfMissing: false,
|
|
205
208
|
updater: new java_update_1.JavaUpdate({
|
|
206
209
|
version,
|
|
@@ -61,6 +61,16 @@ class OCaml extends base_1.BaseStrategy {
|
|
|
61
61
|
}),
|
|
62
62
|
});
|
|
63
63
|
});
|
|
64
|
+
const opamLockedPaths = await this.github.findFilesByExtension('opam.locked', this.path);
|
|
65
|
+
opamLockedPaths.filter(notEsyLock).forEach(path => {
|
|
66
|
+
updates.push({
|
|
67
|
+
path: this.addPath(path),
|
|
68
|
+
createIfMissing: false,
|
|
69
|
+
updater: new opam_1.Opam({
|
|
70
|
+
version,
|
|
71
|
+
}),
|
|
72
|
+
});
|
|
73
|
+
});
|
|
64
74
|
updates.push({
|
|
65
75
|
path: this.addPath('dune-project'),
|
|
66
76
|
createIfMissing: false,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Updater } from '../update';
|
|
2
|
+
import { Version } from '../version';
|
|
3
|
+
export declare class GenericJson implements Updater {
|
|
4
|
+
readonly jsonpath: string;
|
|
5
|
+
readonly version: Version;
|
|
6
|
+
constructor(jsonpath: string, version: Version);
|
|
7
|
+
/**
|
|
8
|
+
* Given initial file contents, return updated contents.
|
|
9
|
+
* @param {string} content The initial content
|
|
10
|
+
* @returns {string} The updated content
|
|
11
|
+
*/
|
|
12
|
+
updateContent(content: string): string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2022 Google LLC
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.GenericJson = void 0;
|
|
17
|
+
const jp = require("jsonpath");
|
|
18
|
+
const json_stringify_1 = require("../util/json-stringify");
|
|
19
|
+
const logger_1 = require("../util/logger");
|
|
20
|
+
class GenericJson {
|
|
21
|
+
constructor(jsonpath, version) {
|
|
22
|
+
this.jsonpath = jsonpath;
|
|
23
|
+
this.version = version;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Given initial file contents, return updated contents.
|
|
27
|
+
* @param {string} content The initial content
|
|
28
|
+
* @returns {string} The updated content
|
|
29
|
+
*/
|
|
30
|
+
updateContent(content) {
|
|
31
|
+
const data = JSON.parse(content);
|
|
32
|
+
const nodes = jp.apply(data, this.jsonpath, _val => {
|
|
33
|
+
return this.version.toString();
|
|
34
|
+
});
|
|
35
|
+
if (!nodes) {
|
|
36
|
+
logger_1.logger.warn(`No entries modified in ${this.jsonpath}`);
|
|
37
|
+
return content;
|
|
38
|
+
}
|
|
39
|
+
return json_stringify_1.jsonStringify(data, content);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.GenericJson = GenericJson;
|
|
43
|
+
//# sourceMappingURL=generic-json.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Updater } from '../update';
|
|
2
|
+
import { Version } from '../version';
|
|
3
|
+
export declare class GenericXml implements Updater {
|
|
4
|
+
private xpath;
|
|
5
|
+
private version;
|
|
6
|
+
constructor(xpath: string, version: Version);
|
|
7
|
+
/**
|
|
8
|
+
* Given initial file contents, return updated contents.
|
|
9
|
+
* @param {string} content The initial content
|
|
10
|
+
* @returns {string} The updated content
|
|
11
|
+
*/
|
|
12
|
+
updateContent(content: string): string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2022 Google LLC
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.GenericXml = void 0;
|
|
17
|
+
const xpath = require("xpath");
|
|
18
|
+
const dom = require("xmldom");
|
|
19
|
+
class GenericXml {
|
|
20
|
+
constructor(xpath, version) {
|
|
21
|
+
this.xpath = xpath;
|
|
22
|
+
this.version = version;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Given initial file contents, return updated contents.
|
|
26
|
+
* @param {string} content The initial content
|
|
27
|
+
* @returns {string} The updated content
|
|
28
|
+
*/
|
|
29
|
+
updateContent(content) {
|
|
30
|
+
const document = new dom.DOMParser().parseFromString(content);
|
|
31
|
+
const iterator = xpath.evaluate(this.xpath, document, null, 0, null);
|
|
32
|
+
let node;
|
|
33
|
+
let updated = false;
|
|
34
|
+
while ((node = iterator.iterateNext())) {
|
|
35
|
+
node.textContent = this.version.toString();
|
|
36
|
+
updated = true;
|
|
37
|
+
}
|
|
38
|
+
if (updated) {
|
|
39
|
+
return new dom.XMLSerializer().serializeToString(document);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
return content;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.GenericXml = GenericXml;
|
|
47
|
+
//# sourceMappingURL=generic-xml.js.map
|
|
@@ -18,7 +18,7 @@ const version_1 = require("../version");
|
|
|
18
18
|
const semver = require("semver");
|
|
19
19
|
const default_1 = require("./default");
|
|
20
20
|
const versioning_strategy_1 = require("../versioning-strategy");
|
|
21
|
-
const DEPENDENCY_UPDATE_REGEX = /^deps: update dependency (.*) to (v
|
|
21
|
+
const DEPENDENCY_UPDATE_REGEX = /^deps: update dependency (.*) to (v[^\s]*)(\s\(#\d+\))?$/m;
|
|
22
22
|
/**
|
|
23
23
|
* This VersioningStrategy looks at `deps` type commits and tries to
|
|
24
24
|
* mirror the semantic version bump for that dependency update. For
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "release-please",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.6.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",
|
|
@@ -41,11 +41,13 @@
|
|
|
41
41
|
"@types/chai": "^4.1.7",
|
|
42
42
|
"@types/iarna__toml": "^2.0.1",
|
|
43
43
|
"@types/js-yaml": "^4.0.0",
|
|
44
|
+
"@types/jsonpath": "^0.2.0",
|
|
44
45
|
"@types/mocha": "^9.0.0",
|
|
45
46
|
"@types/node": "^16.0.0",
|
|
46
47
|
"@types/pino": "^7.0.0",
|
|
47
48
|
"@types/semver": "^7.0.0",
|
|
48
49
|
"@types/sinon": "^10.0.0",
|
|
50
|
+
"@types/xmldom": "^0.1.31",
|
|
49
51
|
"@types/yargs": "^17.0.0",
|
|
50
52
|
"c8": "^7.0.0",
|
|
51
53
|
"chai": "^4.2.0",
|
|
@@ -76,6 +78,7 @@
|
|
|
76
78
|
"detect-indent": "^6.1.0",
|
|
77
79
|
"figures": "^3.0.0",
|
|
78
80
|
"js-yaml": "^4.0.0",
|
|
81
|
+
"jsonpath": "^1.1.1",
|
|
79
82
|
"node-html-parser": "^5.0.0",
|
|
80
83
|
"parse-github-repo-url": "^1.4.1",
|
|
81
84
|
"semver": "^7.0.0",
|
|
@@ -83,6 +86,8 @@
|
|
|
83
86
|
"typescript": "^3.8.3",
|
|
84
87
|
"unist-util-visit": "^2.0.3",
|
|
85
88
|
"unist-util-visit-parents": "^3.1.1",
|
|
89
|
+
"xmldom": "^0.6.0",
|
|
90
|
+
"xpath": "^0.0.32",
|
|
86
91
|
"yargs": "^17.0.0"
|
|
87
92
|
},
|
|
88
93
|
"engines": {
|