release-please 13.6.0 → 13.8.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 +27 -0
- package/build/src/bin/release-please.js +7 -0
- package/build/src/changelog-notes.d.ts +2 -1
- package/build/src/factory.d.ts +1 -1
- package/build/src/factory.js +3 -0
- package/build/src/manifest.d.ts +6 -0
- package/build/src/manifest.js +73 -27
- package/build/src/plugins/node-workspace.d.ts +1 -1
- package/build/src/strategies/base.d.ts +3 -1
- package/build/src/strategies/base.js +7 -5
- package/build/src/strategies/dotnet-yoshi.d.ts +12 -0
- package/build/src/strategies/dotnet-yoshi.js +96 -0
- package/build/src/strategies/go-yoshi.d.ts +2 -2
- package/build/src/strategies/go-yoshi.js +2 -2
- package/build/src/strategies/php-yoshi.js +2 -1
- package/build/src/updaters/dotnet/apis.d.ts +17 -0
- package/build/src/updaters/dotnet/apis.js +45 -0
- package/build/src/util/tag-name.d.ts +2 -1
- package/build/src/util/tag-name.js +6 -5
- package/package.json +5 -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.8.0](https://github.com/googleapis/release-please/compare/v13.7.1...v13.8.0) (2022-03-31)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* add dotnet-yoshi strategy ([#1346](https://github.com/googleapis/release-please/issues/1346)) ([3086e51](https://github.com/googleapis/release-please/commit/3086e5148e596751a2c2b82c28a7b3d3c1b960f2))
|
|
13
|
+
* allow configuring tag without "v" ([3086e51](https://github.com/googleapis/release-please/commit/3086e5148e596751a2c2b82c28a7b3d3c1b960f2))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* **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)
|
|
19
|
+
|
|
20
|
+
### [13.7.1](https://github.com/googleapis/release-please/compare/v13.7.0...v13.7.1) (2022-03-30)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* use lerna typings provided by DefinitelyTyped project ([#1351](https://github.com/googleapis/release-please/issues/1351)) ([86dccdf](https://github.com/googleapis/release-please/commit/86dccdf9dd2fbd8c517a88f4422412c18a944e07))
|
|
26
|
+
|
|
27
|
+
## [13.7.0](https://github.com/googleapis/release-please/compare/v13.6.0...v13.7.0) (2022-03-24)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Features
|
|
31
|
+
|
|
32
|
+
* allow snoozing release pull requests ([#1345](https://github.com/googleapis/release-please/issues/1345)) ([ea69708](https://github.com/googleapis/release-please/commit/ea6970813a11cebe2394c19d8d006d352c8fb306)), closes [#1339](https://github.com/googleapis/release-please/issues/1339)
|
|
33
|
+
|
|
7
34
|
## [13.6.0](https://github.com/googleapis/release-please/compare/v13.5.0...v13.6.0) (2022-03-16)
|
|
8
35
|
|
|
9
36
|
|
|
@@ -238,6 +238,11 @@ function manifestOptions(yargs) {
|
|
|
238
238
|
}
|
|
239
239
|
function taggingOptions(yargs) {
|
|
240
240
|
return yargs
|
|
241
|
+
.option('include-v-in-tags', {
|
|
242
|
+
describe: 'include "v" in tag versions',
|
|
243
|
+
type: 'boolean',
|
|
244
|
+
default: true,
|
|
245
|
+
})
|
|
241
246
|
.option('monorepo-tags', {
|
|
242
247
|
describe: 'include library name in tags and release branches',
|
|
243
248
|
type: 'boolean',
|
|
@@ -275,6 +280,7 @@ const createReleasePullRequestCommand = {
|
|
|
275
280
|
extraFiles: argv.extraFiles,
|
|
276
281
|
versionFile: argv.versionFile,
|
|
277
282
|
includeComponentInTag: argv.monorepoTags,
|
|
283
|
+
includeVInTag: argv.includeVInTags,
|
|
278
284
|
}, extractManifestOptions(argv), argv.path);
|
|
279
285
|
}
|
|
280
286
|
else {
|
|
@@ -324,6 +330,7 @@ const createReleaseCommand = {
|
|
|
324
330
|
draft: argv.draft,
|
|
325
331
|
prerelease: argv.prerelease,
|
|
326
332
|
includeComponentInTag: argv.monorepoTags,
|
|
333
|
+
includeVInTag: argv.includeVInTags,
|
|
327
334
|
}, extractManifestOptions(argv), argv.path);
|
|
328
335
|
}
|
|
329
336
|
else {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConventionalCommit } from './commit';
|
|
1
|
+
import { Commit, ConventionalCommit } from './commit';
|
|
2
2
|
export interface BuildNotesOptions {
|
|
3
3
|
host?: string;
|
|
4
4
|
owner: string;
|
|
@@ -8,6 +8,7 @@ export interface BuildNotesOptions {
|
|
|
8
8
|
currentTag: string;
|
|
9
9
|
targetBranch: string;
|
|
10
10
|
changelogSections?: ChangelogSection[];
|
|
11
|
+
commits?: Commit[];
|
|
11
12
|
}
|
|
12
13
|
export interface ChangelogNotes {
|
|
13
14
|
buildNotes(commits: ConventionalCommit[], options: BuildNotesOptions): Promise<string>;
|
package/build/src/factory.d.ts
CHANGED
|
@@ -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-backport", "java-bom", "java-lts", "java-yoshi", "krm-blueprint", "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[];
|
package/build/src/factory.js
CHANGED
|
@@ -40,12 +40,14 @@ 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");
|
|
43
44
|
// Factory shared by GitHub Action and CLI for creating Release PRs
|
|
44
45
|
// and GitHub Releases:
|
|
45
46
|
// add any new releasers you create to this type as well as the `releasers`
|
|
46
47
|
// object below.
|
|
47
48
|
const allReleaseTypes = [
|
|
48
49
|
'dart',
|
|
50
|
+
'dotnet-yoshi',
|
|
49
51
|
'elixir',
|
|
50
52
|
'go',
|
|
51
53
|
'go-yoshi',
|
|
@@ -67,6 +69,7 @@ const allReleaseTypes = [
|
|
|
67
69
|
'terraform-module',
|
|
68
70
|
];
|
|
69
71
|
const releasers = {
|
|
72
|
+
'dotnet-yoshi': options => new dotnet_yoshi_1.DotnetYoshi(options),
|
|
70
73
|
go: options => new go_1.Go(options),
|
|
71
74
|
'go-yoshi': options => new go_yoshi_1.GoYoshi(options),
|
|
72
75
|
'java-yoshi': options => new java_yoshi_1.JavaYoshi(options),
|
package/build/src/manifest.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export interface ReleaserConfig {
|
|
|
32
32
|
component?: string;
|
|
33
33
|
packageName?: string;
|
|
34
34
|
includeComponentInTag?: boolean;
|
|
35
|
+
includeVInTag?: boolean;
|
|
35
36
|
pullRequestTitlePattern?: string;
|
|
36
37
|
tagSeparator?: string;
|
|
37
38
|
changelogSections?: ChangelogSection[];
|
|
@@ -64,6 +65,7 @@ interface ReleaserConfigJson {
|
|
|
64
65
|
label?: string;
|
|
65
66
|
'release-label'?: string;
|
|
66
67
|
'include-component-in-tag'?: boolean;
|
|
68
|
+
'include-v-in-tag'?: boolean;
|
|
67
69
|
'changelog-type'?: ChangelogNotesType;
|
|
68
70
|
'pull-request-title-pattern'?: string;
|
|
69
71
|
'tag-separator'?: string;
|
|
@@ -223,7 +225,11 @@ export declare class Manifest {
|
|
|
223
225
|
* @returns {number[]} Pull request numbers of release pull requests
|
|
224
226
|
*/
|
|
225
227
|
createPullRequests(): Promise<(PullRequest | undefined)[]>;
|
|
228
|
+
private findOpenReleasePullRequests;
|
|
229
|
+
private findSnoozedReleasePullRequests;
|
|
226
230
|
private createOrUpdatePullRequest;
|
|
231
|
+
private maybeUpdateExistingPullRequest;
|
|
232
|
+
private maybeUpdateSnoozedPullRequest;
|
|
227
233
|
private findMergedReleasePullRequests;
|
|
228
234
|
/**
|
|
229
235
|
* Find merged, untagged releases and build candidate releases to tag.
|
package/build/src/manifest.js
CHANGED
|
@@ -31,6 +31,7 @@ exports.ROOT_PROJECT_PATH = '.';
|
|
|
31
31
|
const DEFAULT_COMPONENT_NAME = '';
|
|
32
32
|
const DEFAULT_LABELS = ['autorelease: pending'];
|
|
33
33
|
const DEFAULT_RELEASE_LABELS = ['autorelease: tagged'];
|
|
34
|
+
const SNOOZE_LABEL = 'autorelease: snooze';
|
|
34
35
|
exports.MANIFEST_PULL_REQUEST_TITLE_PATTERN = 'chore: release ${branch}';
|
|
35
36
|
class Manifest {
|
|
36
37
|
/**
|
|
@@ -359,7 +360,7 @@ class Manifest {
|
|
|
359
360
|
continue;
|
|
360
361
|
}
|
|
361
362
|
const component = await strategiesByPath[path].getComponent();
|
|
362
|
-
const expectedTag = new tag_name_1.TagName(expectedVersion, component, this.repositoryConfig[path].tagSeparator);
|
|
363
|
+
const expectedTag = new tag_name_1.TagName(expectedVersion, component, this.repositoryConfig[path].tagSeparator, this.repositoryConfig[path].includeVInTag);
|
|
363
364
|
logger_1.logger.debug(`looking for tagName: ${expectedTag.toString()}`);
|
|
364
365
|
const foundTag = allTags[expectedTag.toString()];
|
|
365
366
|
if (foundTag) {
|
|
@@ -398,7 +399,18 @@ class Manifest {
|
|
|
398
399
|
logger_1.logger.warn('There are untagged, merged release PRs outstanding - aborting');
|
|
399
400
|
return [];
|
|
400
401
|
}
|
|
401
|
-
// collect open release pull requests
|
|
402
|
+
// collect open and snoozed release pull requests
|
|
403
|
+
const openPullRequests = await this.findOpenReleasePullRequests();
|
|
404
|
+
const snoozedPullRequests = await this.findSnoozedReleasePullRequests();
|
|
405
|
+
const promises = [];
|
|
406
|
+
for (const pullRequest of candidatePullRequests) {
|
|
407
|
+
promises.push(this.createOrUpdatePullRequest(pullRequest, openPullRequests, snoozedPullRequests));
|
|
408
|
+
}
|
|
409
|
+
const pullNumbers = await Promise.all(promises);
|
|
410
|
+
// reject any pull numbers that were not created or updated
|
|
411
|
+
return pullNumbers.filter(number => !!number);
|
|
412
|
+
}
|
|
413
|
+
async findOpenReleasePullRequests() {
|
|
402
414
|
logger_1.logger.info('Looking for open release pull requests');
|
|
403
415
|
const openPullRequests = [];
|
|
404
416
|
const generator = this.github.pullRequestIterator(this.targetBranch, 'OPEN');
|
|
@@ -410,34 +422,66 @@ class Manifest {
|
|
|
410
422
|
}
|
|
411
423
|
}
|
|
412
424
|
logger_1.logger.info(`found ${openPullRequests.length} open release pull requests.`);
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
425
|
+
return openPullRequests;
|
|
426
|
+
}
|
|
427
|
+
async findSnoozedReleasePullRequests() {
|
|
428
|
+
logger_1.logger.info('Looking for snoozed release pull requests');
|
|
429
|
+
const snoozedPullRequests = [];
|
|
430
|
+
const closedGenerator = this.github.pullRequestIterator(this.targetBranch, 'CLOSED');
|
|
431
|
+
for await (const closedPullRequest of closedGenerator) {
|
|
432
|
+
if (hasAllLabels([SNOOZE_LABEL], closedPullRequest.labels) &&
|
|
433
|
+
branch_name_1.BranchName.parse(closedPullRequest.headBranchName) &&
|
|
434
|
+
pull_request_body_1.PullRequestBody.parse(closedPullRequest.body)) {
|
|
435
|
+
snoozedPullRequests.push(closedPullRequest);
|
|
436
|
+
}
|
|
416
437
|
}
|
|
417
|
-
|
|
438
|
+
logger_1.logger.info(`found ${snoozedPullRequests.length} snoozed release pull requests.`);
|
|
439
|
+
return snoozedPullRequests;
|
|
418
440
|
}
|
|
419
|
-
async createOrUpdatePullRequest(pullRequest, openPullRequests) {
|
|
420
|
-
// look for existing, open pull
|
|
441
|
+
async createOrUpdatePullRequest(pullRequest, openPullRequests, snoozedPullRequests) {
|
|
442
|
+
// look for existing, open pull request
|
|
421
443
|
const existing = openPullRequests.find(openPullRequest => openPullRequest.headBranchName === pullRequest.headRefName);
|
|
422
444
|
if (existing) {
|
|
423
|
-
|
|
424
|
-
if (existing.body === pullRequest.body.toString()) {
|
|
425
|
-
logger_1.logger.info(`PR https://github.com/${this.repository.owner}/${this.repository.repo}/pull/${existing.number} remained the same`);
|
|
426
|
-
return undefined;
|
|
427
|
-
}
|
|
428
|
-
const updatedPullRequest = await this.github.updatePullRequest(existing.number, pullRequest, this.targetBranch, {
|
|
429
|
-
fork: this.fork,
|
|
430
|
-
signoffUser: this.signoffUser,
|
|
431
|
-
});
|
|
432
|
-
return updatedPullRequest;
|
|
445
|
+
return await this.maybeUpdateExistingPullRequest(existing, pullRequest);
|
|
433
446
|
}
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
});
|
|
439
|
-
return newPullRequest;
|
|
447
|
+
// look for closed, snoozed pull request
|
|
448
|
+
const snoozed = snoozedPullRequests.find(openPullRequest => openPullRequest.headBranchName === pullRequest.headRefName);
|
|
449
|
+
if (snoozed) {
|
|
450
|
+
return await this.maybeUpdateSnoozedPullRequest(snoozed, pullRequest);
|
|
440
451
|
}
|
|
452
|
+
const newPullRequest = await this.github.createReleasePullRequest(pullRequest, this.targetBranch, {
|
|
453
|
+
fork: this.fork,
|
|
454
|
+
signoffUser: this.signoffUser,
|
|
455
|
+
});
|
|
456
|
+
return newPullRequest;
|
|
457
|
+
}
|
|
458
|
+
/// only update an existing pull request if it has release note changes
|
|
459
|
+
async maybeUpdateExistingPullRequest(existing, pullRequest) {
|
|
460
|
+
// If unchanged, no need to push updates
|
|
461
|
+
if (existing.body === pullRequest.body.toString()) {
|
|
462
|
+
logger_1.logger.info(`PR https://github.com/${this.repository.owner}/${this.repository.repo}/pull/${existing.number} remained the same`);
|
|
463
|
+
return undefined;
|
|
464
|
+
}
|
|
465
|
+
const updatedPullRequest = await this.github.updatePullRequest(existing.number, pullRequest, this.targetBranch, {
|
|
466
|
+
fork: this.fork,
|
|
467
|
+
signoffUser: this.signoffUser,
|
|
468
|
+
});
|
|
469
|
+
return updatedPullRequest;
|
|
470
|
+
}
|
|
471
|
+
/// only update an snoozed pull request if it has release note changes
|
|
472
|
+
async maybeUpdateSnoozedPullRequest(snoozed, pullRequest) {
|
|
473
|
+
// If unchanged, no need to push updates
|
|
474
|
+
if (snoozed.body === pullRequest.body.toString()) {
|
|
475
|
+
logger_1.logger.info(`PR https://github.com/${this.repository.owner}/${this.repository.repo}/pull/${snoozed.number} remained the same`);
|
|
476
|
+
return undefined;
|
|
477
|
+
}
|
|
478
|
+
const updatedPullRequest = await this.github.updatePullRequest(snoozed.number, pullRequest, this.targetBranch, {
|
|
479
|
+
fork: this.fork,
|
|
480
|
+
signoffUser: this.signoffUser,
|
|
481
|
+
});
|
|
482
|
+
// TODO: consider leaving the snooze label
|
|
483
|
+
await this.github.removeIssueLabels([SNOOZE_LABEL], snoozed.number);
|
|
484
|
+
return updatedPullRequest;
|
|
441
485
|
}
|
|
442
486
|
async *findMergedReleasePullRequests() {
|
|
443
487
|
// Find merged release pull requests
|
|
@@ -627,6 +671,7 @@ function extractReleaserConfig(config) {
|
|
|
627
671
|
versionFile: config['version-file'],
|
|
628
672
|
extraFiles: config['extra-files'],
|
|
629
673
|
includeComponentInTag: config['include-component-in-tag'],
|
|
674
|
+
includeVInTag: config['include-v-in-tag'],
|
|
630
675
|
changelogType: config['changelog-type'],
|
|
631
676
|
pullRequestTitlePattern: config['pull-request-title-pattern'],
|
|
632
677
|
tagSeparator: config['tag-separator'],
|
|
@@ -774,7 +819,7 @@ async function latestReleaseVersion(github, targetBranch, prefix, pullRequestTit
|
|
|
774
819
|
return candidateTagVersion.sort((a, b) => b.compare(a))[0];
|
|
775
820
|
}
|
|
776
821
|
function mergeReleaserConfig(defaultConfig, pathConfig) {
|
|
777
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
822
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
778
823
|
return {
|
|
779
824
|
releaseType: (_b = (_a = pathConfig.releaseType) !== null && _a !== void 0 ? _a : defaultConfig.releaseType) !== null && _b !== void 0 ? _b : 'node',
|
|
780
825
|
bumpMinorPreMajor: (_c = pathConfig.bumpMinorPreMajor) !== null && _c !== void 0 ? _c : defaultConfig.bumpMinorPreMajor,
|
|
@@ -790,8 +835,9 @@ function mergeReleaserConfig(defaultConfig, pathConfig) {
|
|
|
790
835
|
versionFile: (_o = pathConfig.versionFile) !== null && _o !== void 0 ? _o : defaultConfig.versionFile,
|
|
791
836
|
extraFiles: (_p = pathConfig.extraFiles) !== null && _p !== void 0 ? _p : defaultConfig.extraFiles,
|
|
792
837
|
includeComponentInTag: (_q = pathConfig.includeComponentInTag) !== null && _q !== void 0 ? _q : defaultConfig.includeComponentInTag,
|
|
793
|
-
|
|
794
|
-
|
|
838
|
+
includeVInTag: (_r = pathConfig.includeVInTag) !== null && _r !== void 0 ? _r : defaultConfig.includeVInTag,
|
|
839
|
+
tagSeparator: (_s = pathConfig.tagSeparator) !== null && _s !== void 0 ? _s : defaultConfig.tagSeparator,
|
|
840
|
+
pullRequestTitlePattern: (_t = pathConfig.pullRequestTitlePattern) !== null && _t !== void 0 ? _t : defaultConfig.pullRequestTitlePattern,
|
|
795
841
|
};
|
|
796
842
|
}
|
|
797
843
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Package as LernaPackage, PackageJson } from '@lerna/package';
|
|
1
|
+
import { Package as LernaPackage, RawManifest as PackageJson } from '@lerna/package';
|
|
2
2
|
import { GitHub } from '../github';
|
|
3
3
|
import { CandidateReleasePullRequest, RepositoryConfig } from '../manifest';
|
|
4
4
|
import { Version, VersionsMap } from '../version';
|
|
@@ -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,6 +58,7 @@ export declare abstract class BaseStrategy implements Strategy {
|
|
|
57
58
|
private skipGitHubRelease;
|
|
58
59
|
private releaseAs?;
|
|
59
60
|
protected includeComponentInTag: boolean;
|
|
61
|
+
protected includeVInTag: boolean;
|
|
60
62
|
private pullRequestTitlePattern?;
|
|
61
63
|
readonly extraFiles: ExtraFile[];
|
|
62
64
|
readonly changelogNotes: ChangelogNotes;
|
|
@@ -82,7 +84,7 @@ export declare abstract class BaseStrategy implements Strategy {
|
|
|
82
84
|
* @returns {ConventionalCommit[]} modified commits
|
|
83
85
|
*/
|
|
84
86
|
protected postProcessCommits(commits: ConventionalCommit[]): Promise<ConventionalCommit[]>;
|
|
85
|
-
protected buildReleaseNotes(conventionalCommits: ConventionalCommit[], newVersion: Version, newVersionTag: TagName, latestRelease?: Release): Promise<string>;
|
|
87
|
+
protected buildReleaseNotes(conventionalCommits: ConventionalCommit[], newVersion: Version, newVersionTag: TagName, latestRelease?: Release, commits?: Commit[]): Promise<string>;
|
|
86
88
|
protected buildPullRequestBody(component: string | undefined, newVersion: Version, releaseNotesBody: string, _conventionalCommits: ConventionalCommit[], _latestRelease?: Release): Promise<PullRequestBody>;
|
|
87
89
|
/**
|
|
88
90
|
* Builds a candidate release pull request
|
|
@@ -35,7 +35,7 @@ const DEFAULT_CHANGELOG_PATH = 'CHANGELOG.md';
|
|
|
35
35
|
*/
|
|
36
36
|
class BaseStrategy {
|
|
37
37
|
constructor(options) {
|
|
38
|
-
var _a;
|
|
38
|
+
var _a, _b;
|
|
39
39
|
this.path = options.path || manifest_1.ROOT_PROJECT_PATH;
|
|
40
40
|
this.github = options.github;
|
|
41
41
|
this.packageName = options.packageName;
|
|
@@ -53,6 +53,7 @@ class BaseStrategy {
|
|
|
53
53
|
this.changelogNotes =
|
|
54
54
|
options.changelogNotes || new default_2.DefaultChangelogNotes(options);
|
|
55
55
|
this.includeComponentInTag = (_a = options.includeComponentInTag) !== null && _a !== void 0 ? _a : true;
|
|
56
|
+
this.includeVInTag = (_b = options.includeVInTag) !== null && _b !== void 0 ? _b : true;
|
|
56
57
|
this.pullRequestTitlePattern = options.pullRequestTitlePattern;
|
|
57
58
|
this.extraFiles = options.extraFiles || [];
|
|
58
59
|
}
|
|
@@ -92,7 +93,7 @@ class BaseStrategy {
|
|
|
92
93
|
async postProcessCommits(commits) {
|
|
93
94
|
return commits;
|
|
94
95
|
}
|
|
95
|
-
async buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease) {
|
|
96
|
+
async buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease, commits) {
|
|
96
97
|
var _a;
|
|
97
98
|
return await this.changelogNotes.buildNotes(conventionalCommits, {
|
|
98
99
|
owner: this.repository.owner,
|
|
@@ -102,6 +103,7 @@ class BaseStrategy {
|
|
|
102
103
|
currentTag: newVersionTag.toString(),
|
|
103
104
|
targetBranch: this.targetBranch,
|
|
104
105
|
changelogSections: this.changelogSections,
|
|
106
|
+
commits: commits,
|
|
105
107
|
});
|
|
106
108
|
}
|
|
107
109
|
async buildPullRequestBody(component, newVersion, releaseNotesBody, _conventionalCommits, _latestRelease) {
|
|
@@ -135,13 +137,13 @@ class BaseStrategy {
|
|
|
135
137
|
const versionsMap = await this.updateVersionsMap(await this.buildVersionsMap(conventionalCommits), conventionalCommits);
|
|
136
138
|
const component = await this.getComponent();
|
|
137
139
|
logger_1.logger.debug('component:', component);
|
|
138
|
-
const newVersionTag = new tag_name_1.TagName(newVersion, this.includeComponentInTag ? component : undefined, this.tagSeparator);
|
|
140
|
+
const newVersionTag = new tag_name_1.TagName(newVersion, this.includeComponentInTag ? component : undefined, this.tagSeparator, this.includeVInTag);
|
|
139
141
|
logger_1.logger.debug('pull request title pattern:', this.pullRequestTitlePattern);
|
|
140
142
|
const pullRequestTitle = pull_request_title_1.PullRequestTitle.ofComponentTargetBranchVersion(component || '', this.targetBranch, newVersion, this.pullRequestTitlePattern);
|
|
141
143
|
const branchName = component
|
|
142
144
|
? branch_name_1.BranchName.ofComponentTargetBranch(component, this.targetBranch)
|
|
143
145
|
: branch_name_1.BranchName.ofTargetBranch(this.targetBranch);
|
|
144
|
-
const releaseNotesBody = await this.buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease);
|
|
146
|
+
const releaseNotesBody = await this.buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease, commits);
|
|
145
147
|
if (this.changelogEmpty(releaseNotesBody)) {
|
|
146
148
|
logger_1.logger.info(`No user facing commits found since ${latestRelease ? latestRelease.sha : 'beginning of time'} - skipping`);
|
|
147
149
|
return undefined;
|
|
@@ -287,7 +289,7 @@ class BaseStrategy {
|
|
|
287
289
|
logger_1.logger.error('Pull request should have included version');
|
|
288
290
|
return;
|
|
289
291
|
}
|
|
290
|
-
const tag = new tag_name_1.TagName(version, this.includeComponentInTag ? component : undefined, this.tagSeparator);
|
|
292
|
+
const tag = new tag_name_1.TagName(version, this.includeComponentInTag ? component : undefined, this.tagSeparator, this.includeVInTag);
|
|
291
293
|
const releaseName = component && this.includeComponentInTag
|
|
292
294
|
? `${component}: v${version.toString()}`
|
|
293
295
|
: `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
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
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.DotnetYoshi = void 0;
|
|
17
|
+
const base_1 = require("./base");
|
|
18
|
+
const changelog_1 = require("../updaters/changelog");
|
|
19
|
+
const apis_1 = require("../updaters/dotnet/apis");
|
|
20
|
+
const logger_1 = require("../util/logger");
|
|
21
|
+
const errors_1 = require("../errors");
|
|
22
|
+
const CHANGELOG_SECTIONS = [
|
|
23
|
+
{ type: 'feat', section: 'New features' },
|
|
24
|
+
{ type: 'fix', section: 'Bug fixes' },
|
|
25
|
+
{ type: 'perf', section: 'Performance improvements' },
|
|
26
|
+
{ type: 'revert', section: 'Reverts' },
|
|
27
|
+
{ type: 'chore', section: 'Miscellaneous chores', hidden: true },
|
|
28
|
+
{ type: 'docs', section: 'Documentation improvements' },
|
|
29
|
+
{ type: 'style', section: 'Styles', hidden: true },
|
|
30
|
+
{ type: 'refactor', section: 'Code Refactoring', hidden: true },
|
|
31
|
+
{ type: 'test', section: 'Tests', hidden: true },
|
|
32
|
+
{ type: 'build', section: 'Build System', hidden: true },
|
|
33
|
+
{ type: 'ci', section: 'Continuous Integration', hidden: true },
|
|
34
|
+
];
|
|
35
|
+
const DEFAULT_CHANGELOG_PATH = 'docs/history.md';
|
|
36
|
+
const DEFAULT_PULL_REQUEST_TITLE_PATTERN = 'Release${component} version ${version}';
|
|
37
|
+
const RELEASE_NOTES_HEADER_PATTERN = /#{2,3} \[?(\d+\.\d+\.\d+-?[^\]]*)\]?.* \((\d{4}-\d{2}-\d{2})\)/;
|
|
38
|
+
class DotnetYoshi extends base_1.BaseStrategy {
|
|
39
|
+
constructor(options) {
|
|
40
|
+
var _a, _b, _c, _d;
|
|
41
|
+
options.changelogSections = (_a = options.changelogSections) !== null && _a !== void 0 ? _a : CHANGELOG_SECTIONS;
|
|
42
|
+
options.changelogPath = (_b = options.changelogPath) !== null && _b !== void 0 ? _b : DEFAULT_CHANGELOG_PATH;
|
|
43
|
+
options.pullRequestTitlePattern = (_c = options.pullRequestTitlePattern) !== null && _c !== void 0 ? _c : DEFAULT_PULL_REQUEST_TITLE_PATTERN;
|
|
44
|
+
options.includeVInTag = (_d = options.includeVInTag) !== null && _d !== void 0 ? _d : false;
|
|
45
|
+
super(options);
|
|
46
|
+
}
|
|
47
|
+
async buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease) {
|
|
48
|
+
const notes = await super.buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease);
|
|
49
|
+
return notes.replace(RELEASE_NOTES_HEADER_PATTERN, '## Version $1, released $2');
|
|
50
|
+
}
|
|
51
|
+
async getApi() {
|
|
52
|
+
try {
|
|
53
|
+
const contents = await this.github.getFileContentsOnBranch('apis/apis.json', this.targetBranch);
|
|
54
|
+
const apis = JSON.parse(contents.parsedContent);
|
|
55
|
+
const component = await this.getComponent();
|
|
56
|
+
return apis.apis.find(api => api.id === component);
|
|
57
|
+
}
|
|
58
|
+
catch (e) {
|
|
59
|
+
if (e instanceof errors_1.FileNotFoundError) {
|
|
60
|
+
throw new errors_1.MissingRequiredFileError('apis/apis.json', DotnetYoshi.name, `${this.repository.owner}/${this.repository.repo}`);
|
|
61
|
+
}
|
|
62
|
+
throw e;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async buildUpdates(options) {
|
|
66
|
+
const updates = [];
|
|
67
|
+
const version = options.newVersion;
|
|
68
|
+
const component = await this.getComponent();
|
|
69
|
+
const api = await this.getApi();
|
|
70
|
+
if (api === null || api === void 0 ? void 0 : api.noVersionHistory) {
|
|
71
|
+
logger_1.logger.info(`Skipping changelog for ${component} via noVersionHistory configuration`);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
updates.push({
|
|
75
|
+
path: this.addPath(this.changelogPath),
|
|
76
|
+
createIfMissing: true,
|
|
77
|
+
updater: new changelog_1.Changelog({
|
|
78
|
+
version,
|
|
79
|
+
changelogEntry: options.changelogEntry,
|
|
80
|
+
}),
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
if (!this.component) {
|
|
84
|
+
logger_1.logger.warn('Dotnet strategy expects to use components, could not update all files');
|
|
85
|
+
return updates;
|
|
86
|
+
}
|
|
87
|
+
updates.push({
|
|
88
|
+
path: 'apis/apis.json',
|
|
89
|
+
createIfMissing: false,
|
|
90
|
+
updater: new apis_1.Apis(this.component, version),
|
|
91
|
+
});
|
|
92
|
+
return updates;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
exports.DotnetYoshi = DotnetYoshi;
|
|
96
|
+
//# sourceMappingURL=dotnet-yoshi.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseStrategy, BuildUpdatesOptions, BaseStrategyOptions } from './base';
|
|
2
2
|
import { Update } from '../update';
|
|
3
|
-
import { ConventionalCommit } from '../commit';
|
|
3
|
+
import { Commit, ConventionalCommit } from '../commit';
|
|
4
4
|
import { Version } from '../version';
|
|
5
5
|
import { TagName } from '../util/tag-name';
|
|
6
6
|
import { Release } from '../release';
|
|
@@ -9,6 +9,6 @@ export declare class GoYoshi extends BaseStrategy {
|
|
|
9
9
|
protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
|
|
10
10
|
protected postProcessCommits(commits: ConventionalCommit[]): Promise<ConventionalCommit[]>;
|
|
11
11
|
getIgnoredSubModules(): Promise<Set<string>>;
|
|
12
|
-
protected buildReleaseNotes(conventionalCommits: ConventionalCommit[], newVersion: Version, newVersionTag: TagName, latestRelease?: Release): Promise<string>;
|
|
12
|
+
protected buildReleaseNotes(conventionalCommits: ConventionalCommit[], newVersion: Version, newVersionTag: TagName, latestRelease?: Release, commits?: Commit[]): Promise<string>;
|
|
13
13
|
protected initialReleaseVersion(): Version;
|
|
14
14
|
}
|
|
@@ -137,8 +137,8 @@ class GoYoshi extends base_1.BaseStrategy {
|
|
|
137
137
|
}
|
|
138
138
|
// "closes" is a little presumptuous, let's just indicate that the
|
|
139
139
|
// PR references these other commits:
|
|
140
|
-
async buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease) {
|
|
141
|
-
const releaseNotes = await super.buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease);
|
|
140
|
+
async buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease, commits) {
|
|
141
|
+
const releaseNotes = await super.buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease, commits);
|
|
142
142
|
return releaseNotes.replace(/, closes /g, ', refs ');
|
|
143
143
|
}
|
|
144
144
|
initialReleaseVersion() {
|
|
@@ -28,6 +28,7 @@ const tag_name_1 = require("../util/tag-name");
|
|
|
28
28
|
const pull_request_title_1 = require("../util/pull-request-title");
|
|
29
29
|
const branch_name_1 = require("../util/branch-name");
|
|
30
30
|
const pull_request_body_1 = require("../util/pull-request-body");
|
|
31
|
+
const errors_1 = require("../errors");
|
|
31
32
|
const CHANGELOG_SECTIONS = [
|
|
32
33
|
{ type: 'feat', section: 'Features' },
|
|
33
34
|
{ type: 'fix', section: 'Bug Fixes' },
|
|
@@ -89,7 +90,7 @@ class PHPYoshi extends base_1.BaseStrategy {
|
|
|
89
90
|
releaseNotesBody = updatePHPChangelogEntry(`${composer.name} ${newVersion.toString()}`, releaseNotesBody, partialReleaseNotes);
|
|
90
91
|
}
|
|
91
92
|
catch (err) {
|
|
92
|
-
if (err
|
|
93
|
+
if (err instanceof errors_1.FileNotFoundError) {
|
|
93
94
|
// if the updated path has no VERSION, assume this isn't a
|
|
94
95
|
// module that needs updating.
|
|
95
96
|
continue;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Updater } from '../../update';
|
|
2
|
+
import { Version } from '../../version';
|
|
3
|
+
/**
|
|
4
|
+
* Updates the apis.json format. See
|
|
5
|
+
* https://github.com/googleapis/google-cloud-dotnet/blob/main/apis/README.md.
|
|
6
|
+
*/
|
|
7
|
+
export declare class Apis implements Updater {
|
|
8
|
+
private version;
|
|
9
|
+
private component;
|
|
10
|
+
constructor(component: string, version: Version);
|
|
11
|
+
/**
|
|
12
|
+
* Given initial file contents, return updated contents.
|
|
13
|
+
* @param {string} content The initial content
|
|
14
|
+
* @returns {string} The updated content
|
|
15
|
+
*/
|
|
16
|
+
updateContent(content: string): string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
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.Apis = void 0;
|
|
17
|
+
const logger_1 = require("../../util/logger");
|
|
18
|
+
const json_stringify_1 = require("../../util/json-stringify");
|
|
19
|
+
/**
|
|
20
|
+
* Updates the apis.json format. See
|
|
21
|
+
* https://github.com/googleapis/google-cloud-dotnet/blob/main/apis/README.md.
|
|
22
|
+
*/
|
|
23
|
+
class Apis {
|
|
24
|
+
constructor(component, version) {
|
|
25
|
+
this.component = component;
|
|
26
|
+
this.version = version;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Given initial file contents, return updated contents.
|
|
30
|
+
* @param {string} content The initial content
|
|
31
|
+
* @returns {string} The updated content
|
|
32
|
+
*/
|
|
33
|
+
updateContent(content) {
|
|
34
|
+
const data = JSON.parse(content);
|
|
35
|
+
const api = data.apis.find(api => api.id === this.component);
|
|
36
|
+
if (!api) {
|
|
37
|
+
logger_1.logger.warn(`Failed to find component: ${this.component} in apis.json`);
|
|
38
|
+
return content;
|
|
39
|
+
}
|
|
40
|
+
api.version = this.version.toString();
|
|
41
|
+
return json_stringify_1.jsonStringify(data, content);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.Apis = Apis;
|
|
45
|
+
//# sourceMappingURL=apis.js.map
|
|
@@ -3,7 +3,8 @@ export declare class TagName {
|
|
|
3
3
|
component?: string;
|
|
4
4
|
version: Version;
|
|
5
5
|
separator: string;
|
|
6
|
-
|
|
6
|
+
includeV: boolean;
|
|
7
|
+
constructor(version: Version, component?: string, separator?: string, includeV?: boolean);
|
|
7
8
|
static parse(tagName: string): TagName | undefined;
|
|
8
9
|
toString(): string;
|
|
9
10
|
}
|
|
@@ -15,26 +15,27 @@
|
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.TagName = void 0;
|
|
17
17
|
const version_1 = require("../version");
|
|
18
|
-
const TAG_PATTERN = /^((?<component>.*)(?<separator>[^a-zA-Z]))?v(?<version>\d+\.\d+\.\d+.*)$/;
|
|
18
|
+
const TAG_PATTERN = /^((?<component>.*)(?<separator>[^a-zA-Z]))?(?<v>v)?(?<version>\d+\.\d+\.\d+.*)$/;
|
|
19
19
|
const DEFAULT_SEPARATOR = '-';
|
|
20
20
|
class TagName {
|
|
21
|
-
constructor(version, component, separator = DEFAULT_SEPARATOR) {
|
|
21
|
+
constructor(version, component, separator = DEFAULT_SEPARATOR, includeV = true) {
|
|
22
22
|
this.version = version;
|
|
23
23
|
this.component = component;
|
|
24
24
|
this.separator = separator;
|
|
25
|
+
this.includeV = includeV;
|
|
25
26
|
}
|
|
26
27
|
static parse(tagName) {
|
|
27
28
|
const match = tagName.match(TAG_PATTERN);
|
|
28
29
|
if (match === null || match === void 0 ? void 0 : match.groups) {
|
|
29
|
-
return new TagName(version_1.Version.parse(match.groups.version), match.groups.component, match.groups.separator);
|
|
30
|
+
return new TagName(version_1.Version.parse(match.groups.version), match.groups.component, match.groups.separator, !!match.groups.v);
|
|
30
31
|
}
|
|
31
32
|
return;
|
|
32
33
|
}
|
|
33
34
|
toString() {
|
|
34
35
|
if (this.component) {
|
|
35
|
-
return `${this.component}${this.separator}v${this.version.toString()}`;
|
|
36
|
+
return `${this.component}${this.separator}${this.includeV ? 'v' : ''}${this.version.toString()}`;
|
|
36
37
|
}
|
|
37
|
-
return
|
|
38
|
+
return `${this.includeV ? 'v' : ''}${this.version.toString()}`;
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
exports.TagName = TagName;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "release-please",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.8.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",
|
|
@@ -42,6 +42,10 @@
|
|
|
42
42
|
"@types/iarna__toml": "^2.0.1",
|
|
43
43
|
"@types/js-yaml": "^4.0.0",
|
|
44
44
|
"@types/jsonpath": "^0.2.0",
|
|
45
|
+
"@types/lerna__collect-updates": "^4.0.0",
|
|
46
|
+
"@types/lerna__package": "^4.0.2",
|
|
47
|
+
"@types/lerna__package-graph": "^4.0.1",
|
|
48
|
+
"@types/lerna__run-topologically": "^4.0.0",
|
|
45
49
|
"@types/mocha": "^9.0.0",
|
|
46
50
|
"@types/node": "^16.0.0",
|
|
47
51
|
"@types/pino": "^7.0.0",
|