release-please 13.2.1 → 13.4.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 +42 -0
- package/build/src/changelog-notes/default.js +5 -2
- package/build/src/factory.js +6 -1
- package/build/src/github.js +1 -1
- package/build/src/manifest.d.ts +3 -0
- package/build/src/manifest.js +5 -2
- package/build/src/plugins/merge.d.ts +4 -1
- package/build/src/plugins/merge.js +10 -1
- package/build/src/strategies/base.d.ts +3 -2
- package/build/src/strategies/base.js +23 -14
- package/build/src/strategies/go-yoshi.d.ts +1 -1
- package/build/src/strategies/go-yoshi.js +38 -1
- package/build/src/strategies/java-yoshi.js +3 -3
- package/build/src/strategies/php-yoshi.js +1 -1
- package/build/src/strategies/python.js +1 -1
- package/build/src/strategies/ruby-yoshi.d.ts +3 -3
- package/build/src/strategies/ruby-yoshi.js +13 -5
- package/build/src/strategies/ruby.d.ts +1 -1
- package/build/src/strategies/ruby.js +1 -1
- package/build/src/strategies/simple.d.ts +7 -1
- package/build/src/strategies/simple.js +6 -1
- package/build/src/strategies/terraform-module.js +3 -3
- package/build/src/util/branch-name.js +12 -5
- package/build/src/util/pull-request-body.d.ts +2 -0
- package/build/src/util/pull-request-body.js +2 -1
- package/build/src/util/pull-request-title.d.ts +1 -1
- package/build/src/versioning-strategies/default.js +4 -5
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,48 @@
|
|
|
4
4
|
|
|
5
5
|
[1]: https://www.npmjs.com/package/release-please?activeTab=versions
|
|
6
6
|
|
|
7
|
+
## [13.4.0](https://github.com/googleapis/release-please/compare/v13.3.2...v13.4.0) (2022-01-18)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* add grouped manifest pr title pattern option ([#1184](https://github.com/googleapis/release-please/issues/1184)) ([df1332f](https://github.com/googleapis/release-please/commit/df1332f3b95e622752d351a29fc0a1b5083963c6))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **go-yoshi:** restore scope-based commit filtering ([#1233](https://github.com/googleapis/release-please/issues/1233)) ([597e6dd](https://github.com/googleapis/release-please/commit/597e6dd58217c62d562070032138cee8cad5e693))
|
|
18
|
+
* search for files on target branch, not default branch ([#1235](https://github.com/googleapis/release-please/issues/1235)) ([d891f00](https://github.com/googleapis/release-please/commit/d891f000eb2b198bfb4331b41bc5020fff52e1da))
|
|
19
|
+
|
|
20
|
+
### [13.3.2](https://github.com/googleapis/release-please/compare/v13.3.1...v13.3.2) (2022-01-13)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* BranchName.parse should not throw exceptions ([#1227](https://github.com/googleapis/release-please/issues/1227)) ([364f1ac](https://github.com/googleapis/release-please/commit/364f1ac996b0120820d9bb37db96bb27a79aa936))
|
|
26
|
+
* initial release version should respect Release-As commit ([#1222](https://github.com/googleapis/release-please/issues/1222)) ([22b9770](https://github.com/googleapis/release-please/commit/22b977028e2959aea088c09e3a021e2aa0e10f03))
|
|
27
|
+
* Release-As commits should appear in the changelog correctly ([#1220](https://github.com/googleapis/release-please/issues/1220)) ([ab56c82](https://github.com/googleapis/release-please/commit/ab56c82e81091cbedeb8f328451ac486d7f986a4))
|
|
28
|
+
* use latest Release-As commit when overriding version ([#1224](https://github.com/googleapis/release-please/issues/1224)) ([2d7cb8f](https://github.com/googleapis/release-please/commit/2d7cb8fa329d1c60b881bc0435523b81ea47a32d))
|
|
29
|
+
|
|
30
|
+
### [13.3.1](https://github.com/googleapis/release-please/compare/v13.3.0...v13.3.1) (2022-01-12)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
|
|
35
|
+
* pass target_commitish instead of sha ([#1219](https://github.com/googleapis/release-please/issues/1219)) ([3f26ec3](https://github.com/googleapis/release-please/commit/3f26ec3de527497d7180f2cd987983c6ae6e44cd))
|
|
36
|
+
|
|
37
|
+
## [13.3.0](https://github.com/googleapis/release-please/compare/v13.2.1...v13.3.0) (2022-01-12)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### Features
|
|
41
|
+
|
|
42
|
+
* allow configuring simple strategy version file ([#1168](https://github.com/googleapis/release-please/issues/1168)) ([08a0cf2](https://github.com/googleapis/release-please/commit/08a0cf2b2135713f856d8621cffa8f5b92fb8699))
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Bug Fixes
|
|
46
|
+
|
|
47
|
+
* ruby-yoshi strategy should put commit summary only in pull request body ([#1193](https://github.com/googleapis/release-please/issues/1193)) ([d29eda1](https://github.com/googleapis/release-please/commit/d29eda172597979cea5cb54ce6eb278a1dfb03a0)), closes [#1192](https://github.com/googleapis/release-please/issues/1192)
|
|
48
|
+
|
|
7
49
|
### [13.2.1](https://github.com/googleapis/release-please/compare/v13.2.0...v13.2.1) (2022-01-12)
|
|
8
50
|
|
|
9
51
|
|
|
@@ -52,13 +52,16 @@ class DefaultChangelogNotes {
|
|
|
52
52
|
subject: commit.bareMessage,
|
|
53
53
|
type: commit.type,
|
|
54
54
|
scope: commit.scope,
|
|
55
|
-
notes: commit.notes,
|
|
55
|
+
notes: commit.notes.filter(note => note.title === 'BREAKING CHANGE'),
|
|
56
56
|
references: commit.references,
|
|
57
57
|
mentions: [],
|
|
58
58
|
merge: null,
|
|
59
59
|
revert: null,
|
|
60
60
|
header: commit.message,
|
|
61
|
-
footer:
|
|
61
|
+
footer: commit.notes
|
|
62
|
+
.filter(note => note.title === 'RELEASE AS')
|
|
63
|
+
.map(note => `Release-As: ${note.text}`)
|
|
64
|
+
.join('\n'),
|
|
62
65
|
hash: commit.sha,
|
|
63
66
|
};
|
|
64
67
|
});
|
package/build/src/factory.js
CHANGED
|
@@ -76,7 +76,6 @@ const releasers = {
|
|
|
76
76
|
'php-yoshi': options => new php_yoshi_1.PHPYoshi(options),
|
|
77
77
|
python: options => new python_1.Python(options),
|
|
78
78
|
rust: options => new rust_1.Rust(options),
|
|
79
|
-
simple: options => new simple_1.Simple(options),
|
|
80
79
|
'terraform-module': options => new terraform_module_1.TerraformModule(options),
|
|
81
80
|
helm: options => new helm_1.Helm(options),
|
|
82
81
|
elixir: options => new elixir_1.Elixir(options),
|
|
@@ -159,6 +158,12 @@ async function buildStrategy(options) {
|
|
|
159
158
|
versioningStrategy: new service_pack_1.ServicePackVersioningStrategy(),
|
|
160
159
|
});
|
|
161
160
|
}
|
|
161
|
+
case 'simple': {
|
|
162
|
+
return new simple_1.Simple({
|
|
163
|
+
...strategyOptions,
|
|
164
|
+
versionFile: options.versionFile,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
162
167
|
default: {
|
|
163
168
|
const builder = releasers[options.releaseType];
|
|
164
169
|
if (builder) {
|
package/build/src/github.js
CHANGED
|
@@ -304,9 +304,9 @@ class GitHub {
|
|
|
304
304
|
repo: this.repository.repo,
|
|
305
305
|
tag_name: release.tag.toString(),
|
|
306
306
|
body: release.notes,
|
|
307
|
-
sha: release.sha,
|
|
308
307
|
draft: !!options.draft,
|
|
309
308
|
prerelease: !!options.prerelease,
|
|
309
|
+
target_commitish: release.sha,
|
|
310
310
|
});
|
|
311
311
|
return {
|
|
312
312
|
name: resp.data.name || undefined,
|
package/build/src/manifest.d.ts
CHANGED
|
@@ -71,6 +71,7 @@ export interface ManifestOptions {
|
|
|
71
71
|
draft?: boolean;
|
|
72
72
|
prerelease?: boolean;
|
|
73
73
|
draftPullRequest?: boolean;
|
|
74
|
+
groupPullRequestTitlePattern?: string;
|
|
74
75
|
}
|
|
75
76
|
interface ReleaserPackageConfig extends ReleaserConfigJson {
|
|
76
77
|
'package-name'?: string;
|
|
@@ -88,6 +89,7 @@ export interface ManifestConfig extends ReleaserConfigJson {
|
|
|
88
89
|
'always-link-local'?: boolean;
|
|
89
90
|
plugins?: PluginType[];
|
|
90
91
|
'separate-pull-requests'?: boolean;
|
|
92
|
+
'group-pull-request-title-pattern'?: string;
|
|
91
93
|
}
|
|
92
94
|
export declare type ReleasedVersions = Record<string, Version>;
|
|
93
95
|
export declare type RepositoryConfig = Record<string, ReleaserConfig>;
|
|
@@ -122,6 +124,7 @@ export declare class Manifest {
|
|
|
122
124
|
private draft?;
|
|
123
125
|
private prerelease?;
|
|
124
126
|
private draftPullRequest?;
|
|
127
|
+
private groupPullRequestTitlePattern?;
|
|
125
128
|
/**
|
|
126
129
|
* Create a Manifest from explicit config in code. This assumes that the
|
|
127
130
|
* repository has a single component at the root path.
|
package/build/src/manifest.js
CHANGED
|
@@ -77,6 +77,7 @@ class Manifest {
|
|
|
77
77
|
this.lastReleaseSha = manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.lastReleaseSha;
|
|
78
78
|
this.draft = manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.draft;
|
|
79
79
|
this.draftPullRequest = manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.draftPullRequest;
|
|
80
|
+
this.groupPullRequestTitlePattern = manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.groupPullRequestTitlePattern;
|
|
80
81
|
}
|
|
81
82
|
/**
|
|
82
83
|
* Create a Manifest from config files in the repository.
|
|
@@ -314,7 +315,7 @@ class Manifest {
|
|
|
314
315
|
// Combine pull requests into 1 unless configured for separate
|
|
315
316
|
// pull requests
|
|
316
317
|
if (!this.separatePullRequests) {
|
|
317
|
-
plugins.push(new merge_1.Merge(this.github, this.targetBranch, this.repositoryConfig));
|
|
318
|
+
plugins.push(new merge_1.Merge(this.github, this.targetBranch, this.repositoryConfig, this.groupPullRequestTitlePattern));
|
|
318
319
|
}
|
|
319
320
|
for (const plugin of plugins) {
|
|
320
321
|
newReleasePullRequests = await plugin.run(newReleasePullRequests);
|
|
@@ -588,6 +589,7 @@ async function parseConfig(github, configFile, branch) {
|
|
|
588
589
|
lastReleaseSha: config['last-release-sha'],
|
|
589
590
|
alwaysLinkLocal: config['always-link-local'],
|
|
590
591
|
separatePullRequests: config['separate-pull-requests'],
|
|
592
|
+
groupPullRequestTitlePattern: config['group-pull-request-title-pattern'],
|
|
591
593
|
plugins: config['plugins'],
|
|
592
594
|
};
|
|
593
595
|
return { config: repositoryConfig, options: manifestOptions };
|
|
@@ -701,7 +703,7 @@ async function latestReleaseVersion(github, targetBranch, prefix, pullRequestTit
|
|
|
701
703
|
return candidateTagVersion.sort((a, b) => b.compare(a))[0];
|
|
702
704
|
}
|
|
703
705
|
function mergeReleaserConfig(defaultConfig, pathConfig) {
|
|
704
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
706
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
705
707
|
return {
|
|
706
708
|
releaseType: (_b = (_a = pathConfig.releaseType) !== null && _a !== void 0 ? _a : defaultConfig.releaseType) !== null && _b !== void 0 ? _b : 'node',
|
|
707
709
|
bumpMinorPreMajor: (_c = pathConfig.bumpMinorPreMajor) !== null && _c !== void 0 ? _c : defaultConfig.bumpMinorPreMajor,
|
|
@@ -716,6 +718,7 @@ function mergeReleaserConfig(defaultConfig, pathConfig) {
|
|
|
716
718
|
packageName: (_m = pathConfig.packageName) !== null && _m !== void 0 ? _m : defaultConfig.packageName,
|
|
717
719
|
versionFile: (_o = pathConfig.versionFile) !== null && _o !== void 0 ? _o : defaultConfig.versionFile,
|
|
718
720
|
extraFiles: (_p = pathConfig.extraFiles) !== null && _p !== void 0 ? _p : defaultConfig.extraFiles,
|
|
721
|
+
pullRequestTitlePattern: (_q = pathConfig.pullRequestTitlePattern) !== null && _q !== void 0 ? _q : defaultConfig.pullRequestTitlePattern,
|
|
719
722
|
};
|
|
720
723
|
}
|
|
721
724
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ManifestPlugin } from '../plugin';
|
|
2
|
-
import { CandidateReleasePullRequest } from '../manifest';
|
|
2
|
+
import { CandidateReleasePullRequest, RepositoryConfig } from '../manifest';
|
|
3
|
+
import { GitHub } from '../github';
|
|
3
4
|
/**
|
|
4
5
|
* This plugin merges multiple pull requests into a single
|
|
5
6
|
* release pull request.
|
|
@@ -7,5 +8,7 @@ import { CandidateReleasePullRequest } from '../manifest';
|
|
|
7
8
|
* Release notes are broken up using `<summary>`/`<details>` blocks.
|
|
8
9
|
*/
|
|
9
10
|
export declare class Merge extends ManifestPlugin {
|
|
11
|
+
private pullRequestTitlePattern?;
|
|
12
|
+
constructor(github: GitHub, targetBranch: string, repositoryConfig: RepositoryConfig, pullRequestTitlePattern?: string);
|
|
10
13
|
run(candidates: CandidateReleasePullRequest[]): Promise<CandidateReleasePullRequest[]>;
|
|
11
14
|
}
|
|
@@ -27,6 +27,11 @@ const composite_1 = require("../updaters/composite");
|
|
|
27
27
|
* Release notes are broken up using `<summary>`/`<details>` blocks.
|
|
28
28
|
*/
|
|
29
29
|
class Merge extends plugin_1.ManifestPlugin {
|
|
30
|
+
constructor(github, targetBranch, repositoryConfig, pullRequestTitlePattern) {
|
|
31
|
+
super(github, targetBranch, repositoryConfig);
|
|
32
|
+
this.pullRequestTitlePattern =
|
|
33
|
+
pullRequestTitlePattern || manifest_1.MANIFEST_PULL_REQUEST_TITLE_PATTERN;
|
|
34
|
+
}
|
|
30
35
|
async run(candidates) {
|
|
31
36
|
if (candidates.length < 1) {
|
|
32
37
|
return candidates;
|
|
@@ -34,6 +39,7 @@ class Merge extends plugin_1.ManifestPlugin {
|
|
|
34
39
|
const releaseData = [];
|
|
35
40
|
const labels = new Set();
|
|
36
41
|
let rawUpdates = [];
|
|
42
|
+
let rootRelease = null;
|
|
37
43
|
for (const candidate of candidates) {
|
|
38
44
|
const pullRequest = candidate.pullRequest;
|
|
39
45
|
rawUpdates = rawUpdates.concat(...pullRequest.updates);
|
|
@@ -41,10 +47,13 @@ class Merge extends plugin_1.ManifestPlugin {
|
|
|
41
47
|
labels.add(label);
|
|
42
48
|
}
|
|
43
49
|
releaseData.push(...pullRequest.body.releaseData);
|
|
50
|
+
if (candidate.path === '.') {
|
|
51
|
+
rootRelease = candidate;
|
|
52
|
+
}
|
|
44
53
|
}
|
|
45
54
|
const updates = composite_1.mergeUpdates(rawUpdates);
|
|
46
55
|
const pullRequest = {
|
|
47
|
-
title: pull_request_title_1.PullRequestTitle.
|
|
56
|
+
title: pull_request_title_1.PullRequestTitle.ofComponentTargetBranchVersion(rootRelease === null || rootRelease === void 0 ? void 0 : rootRelease.pullRequest.title.component, this.targetBranch, rootRelease === null || rootRelease === void 0 ? void 0 : rootRelease.pullRequest.title.version, this.pullRequestTitlePattern),
|
|
48
57
|
body: new pull_request_body_1.PullRequestBody(releaseData),
|
|
49
58
|
updates,
|
|
50
59
|
labels: Array.from(labels),
|
|
@@ -55,7 +55,7 @@ export declare abstract class BaseStrategy implements Strategy {
|
|
|
55
55
|
protected tagSeparator?: string;
|
|
56
56
|
private skipGitHubRelease;
|
|
57
57
|
private releaseAs?;
|
|
58
|
-
|
|
58
|
+
protected includeComponentInTag: boolean;
|
|
59
59
|
private pullRequestTitlePattern?;
|
|
60
60
|
readonly extraFiles: string[];
|
|
61
61
|
readonly changelogNotes: ChangelogNotes;
|
|
@@ -79,8 +79,9 @@ export declare abstract class BaseStrategy implements Strategy {
|
|
|
79
79
|
* @param {ConventionalCommit[]} commits parsed commits
|
|
80
80
|
* @returns {ConventionalCommit[]} modified commits
|
|
81
81
|
*/
|
|
82
|
-
protected postProcessCommits(commits: ConventionalCommit[]): ConventionalCommit[]
|
|
82
|
+
protected postProcessCommits(commits: ConventionalCommit[]): Promise<ConventionalCommit[]>;
|
|
83
83
|
protected buildReleaseNotes(conventionalCommits: ConventionalCommit[], newVersion: Version, newVersionTag: TagName, latestRelease?: Release): Promise<string>;
|
|
84
|
+
protected buildPullRequestBody(component: string | undefined, newVersion: Version, releaseNotesBody: string, _conventionalCommits: ConventionalCommit[], _latestRelease?: Release): Promise<PullRequestBody>;
|
|
84
85
|
/**
|
|
85
86
|
* Builds a candidate release pull request
|
|
86
87
|
* @param {Commit[]} commits Raw commits to consider for this release.
|
|
@@ -81,7 +81,7 @@ class BaseStrategy {
|
|
|
81
81
|
* @param {ConventionalCommit[]} commits parsed commits
|
|
82
82
|
* @returns {ConventionalCommit[]} modified commits
|
|
83
83
|
*/
|
|
84
|
-
postProcessCommits(commits) {
|
|
84
|
+
async postProcessCommits(commits) {
|
|
85
85
|
return commits;
|
|
86
86
|
}
|
|
87
87
|
async buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease) {
|
|
@@ -96,6 +96,15 @@ class BaseStrategy {
|
|
|
96
96
|
changelogSections: this.changelogSections,
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
|
+
async buildPullRequestBody(component, newVersion, releaseNotesBody, _conventionalCommits, _latestRelease) {
|
|
100
|
+
return new pull_request_body_1.PullRequestBody([
|
|
101
|
+
{
|
|
102
|
+
component,
|
|
103
|
+
version: newVersion,
|
|
104
|
+
notes: releaseNotesBody,
|
|
105
|
+
},
|
|
106
|
+
]);
|
|
107
|
+
}
|
|
99
108
|
/**
|
|
100
109
|
* Builds a candidate release pull request
|
|
101
110
|
* @param {Commit[]} commits Raw commits to consider for this release.
|
|
@@ -108,13 +117,14 @@ class BaseStrategy {
|
|
|
108
117
|
* open a pull request.
|
|
109
118
|
*/
|
|
110
119
|
async buildReleasePullRequest(commits, latestRelease, draft, labels = []) {
|
|
111
|
-
const conventionalCommits = this.postProcessCommits(commit_1.parseConventionalCommits(commits));
|
|
120
|
+
const conventionalCommits = await this.postProcessCommits(commit_1.parseConventionalCommits(commits));
|
|
121
|
+
logger_1.logger.info(`Considering: ${conventionalCommits.length} commits`);
|
|
112
122
|
const newVersion = await this.buildNewVersion(conventionalCommits, latestRelease);
|
|
113
123
|
const versionsMap = await this.updateVersionsMap(await this.buildVersionsMap(conventionalCommits), conventionalCommits);
|
|
114
124
|
const component = await this.getComponent();
|
|
115
125
|
logger_1.logger.debug('component:', component);
|
|
116
126
|
const newVersionTag = new tag_name_1.TagName(newVersion, this.includeComponentInTag ? component : undefined, this.tagSeparator);
|
|
117
|
-
logger_1.logger.
|
|
127
|
+
logger_1.logger.debug('pull request title pattern:', this.pullRequestTitlePattern);
|
|
118
128
|
const pullRequestTitle = pull_request_title_1.PullRequestTitle.ofComponentTargetBranchVersion(component || '', this.targetBranch, newVersion, this.pullRequestTitlePattern);
|
|
119
129
|
const branchName = component
|
|
120
130
|
? branch_name_1.BranchName.ofComponentTargetBranch(component, this.targetBranch)
|
|
@@ -131,13 +141,7 @@ class BaseStrategy {
|
|
|
131
141
|
latestVersion: latestRelease === null || latestRelease === void 0 ? void 0 : latestRelease.tag.version,
|
|
132
142
|
});
|
|
133
143
|
const updatesWithExtras = composite_1.mergeUpdates(updates.concat(...this.extraFileUpdates(newVersion)));
|
|
134
|
-
const pullRequestBody =
|
|
135
|
-
{
|
|
136
|
-
component,
|
|
137
|
-
version: newVersion,
|
|
138
|
-
notes: releaseNotesBody,
|
|
139
|
-
},
|
|
140
|
-
]);
|
|
144
|
+
const pullRequestBody = await this.buildPullRequestBody(component, newVersion, releaseNotesBody, conventionalCommits, latestRelease);
|
|
141
145
|
return {
|
|
142
146
|
title: pullRequestTitle,
|
|
143
147
|
body: pullRequestBody,
|
|
@@ -178,12 +182,17 @@ class BaseStrategy {
|
|
|
178
182
|
logger_1.logger.warn(`Setting version for ${this.path} from release-as configuration`);
|
|
179
183
|
return version_1.Version.parse(this.releaseAs);
|
|
180
184
|
}
|
|
181
|
-
|
|
182
|
-
|
|
185
|
+
const releaseAsCommit = conventionalCommits.find(conventionalCommit => conventionalCommit.notes.find(note => note.title === 'RELEASE AS'));
|
|
186
|
+
if (releaseAsCommit) {
|
|
187
|
+
const note = releaseAsCommit.notes.find(note => note.title === 'RELEASE AS');
|
|
188
|
+
if (note) {
|
|
189
|
+
return version_1.Version.parse(note.text);
|
|
190
|
+
}
|
|
183
191
|
}
|
|
184
|
-
|
|
185
|
-
return this.
|
|
192
|
+
if (latestRelease) {
|
|
193
|
+
return await this.versioningStrategy.bump(latestRelease.tag.version, conventionalCommits);
|
|
186
194
|
}
|
|
195
|
+
return this.initialReleaseVersion();
|
|
187
196
|
}
|
|
188
197
|
async buildVersionsMap(_conventionalCommits) {
|
|
189
198
|
return new Map();
|
|
@@ -7,7 +7,7 @@ import { Release } from '../release';
|
|
|
7
7
|
export declare class GoYoshi extends BaseStrategy {
|
|
8
8
|
constructor(options: BaseStrategyOptions);
|
|
9
9
|
protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
|
|
10
|
-
protected postProcessCommits(commits: ConventionalCommit[]): ConventionalCommit[]
|
|
10
|
+
protected postProcessCommits(commits: ConventionalCommit[]): Promise<ConventionalCommit[]>;
|
|
11
11
|
protected buildReleaseNotes(conventionalCommits: ConventionalCommit[], newVersion: Version, newVersionTag: TagName, latestRelease?: Release): Promise<string>;
|
|
12
12
|
protected initialReleaseVersion(): Version;
|
|
13
13
|
}
|
|
@@ -18,6 +18,7 @@ const base_1 = require("./base");
|
|
|
18
18
|
const changelog_1 = require("../updaters/changelog");
|
|
19
19
|
const version_1 = require("../version");
|
|
20
20
|
const version_go_1 = require("../updaters/go/version-go");
|
|
21
|
+
const logger_1 = require("../util/logger");
|
|
21
22
|
// Commits containing a scope prefixed with an item in this array will be
|
|
22
23
|
// ignored when generating a release PR for the parent module.
|
|
23
24
|
const IGNORED_SUB_MODULES = new Set([
|
|
@@ -59,8 +60,10 @@ class GoYoshi extends base_1.BaseStrategy {
|
|
|
59
60
|
});
|
|
60
61
|
return updates;
|
|
61
62
|
}
|
|
62
|
-
postProcessCommits(commits) {
|
|
63
|
+
async postProcessCommits(commits) {
|
|
63
64
|
let regenCommit;
|
|
65
|
+
const component = await this.getComponent();
|
|
66
|
+
logger_1.logger.debug('Filtering commits');
|
|
64
67
|
return commits.filter(commit => {
|
|
65
68
|
var _a, _b;
|
|
66
69
|
// ignore commits whose scope is in the list of ignored modules
|
|
@@ -97,6 +100,37 @@ class GoYoshi extends base_1.BaseStrategy {
|
|
|
97
100
|
}
|
|
98
101
|
}
|
|
99
102
|
}
|
|
103
|
+
// For google-cloud-go, filter into 2 cases, a subset of modules
|
|
104
|
+
// released independently, and the remainder
|
|
105
|
+
if (this.repository.owner === 'googleapis' &&
|
|
106
|
+
this.repository.repo === 'google-cloud-go') {
|
|
107
|
+
// Skip commits that don't have a scope as we don't know where to
|
|
108
|
+
// put them
|
|
109
|
+
if (!commit.scope) {
|
|
110
|
+
logger_1.logger.debug(`Skipping commit without scope: ${commit.message}`);
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
// Skip commits related to sub-modules as they are not part of
|
|
114
|
+
// the parent module.
|
|
115
|
+
if (this.includeComponentInTag) {
|
|
116
|
+
// This is a submodule release, so only include commits in this
|
|
117
|
+
// scope
|
|
118
|
+
if (!commitMatchesScope(commit.scope, component)) {
|
|
119
|
+
logger_1.logger.debug(`Skipping commit scope: ${commit.scope} != ${component}`);
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
// This is the main module release, so ignore sub modules that
|
|
125
|
+
// are released independently
|
|
126
|
+
for (const submodule of IGNORED_SUB_MODULES) {
|
|
127
|
+
if (commitMatchesScope(commit.scope, submodule)) {
|
|
128
|
+
logger_1.logger.debug(`Skipping ignored commit scope: ${commit.scope}`);
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
100
134
|
return true;
|
|
101
135
|
});
|
|
102
136
|
}
|
|
@@ -111,4 +145,7 @@ class GoYoshi extends base_1.BaseStrategy {
|
|
|
111
145
|
}
|
|
112
146
|
}
|
|
113
147
|
exports.GoYoshi = GoYoshi;
|
|
148
|
+
function commitMatchesScope(commitScope, scope) {
|
|
149
|
+
return commitScope === scope || commitScope.startsWith(`${scope}/`);
|
|
150
|
+
}
|
|
114
151
|
//# sourceMappingURL=go-yoshi.js.map
|
|
@@ -136,9 +136,9 @@ class JavaYoshi extends base_1.BaseStrategy {
|
|
|
136
136
|
versionsMap,
|
|
137
137
|
}),
|
|
138
138
|
});
|
|
139
|
-
const pomFilesSearch = this.github.
|
|
140
|
-
const buildFilesSearch = this.github.
|
|
141
|
-
const dependenciesSearch = this.github.
|
|
139
|
+
const pomFilesSearch = this.github.findFilesByFilenameAndRef('pom.xml', this.targetBranch, this.path);
|
|
140
|
+
const buildFilesSearch = this.github.findFilesByFilenameAndRef('build.gradle', this.targetBranch, this.path);
|
|
141
|
+
const dependenciesSearch = this.github.findFilesByFilenameAndRef('dependencies.properties', this.targetBranch, this.path);
|
|
142
142
|
const pomFiles = await pomFilesSearch;
|
|
143
143
|
pomFiles.forEach(path => {
|
|
144
144
|
updates.push({
|
|
@@ -50,7 +50,7 @@ class PHPYoshi extends base_1.BaseStrategy {
|
|
|
50
50
|
}
|
|
51
51
|
async buildReleasePullRequest(commits, latestRelease, draft, labels = []) {
|
|
52
52
|
var _a, _b, _c;
|
|
53
|
-
const conventionalCommits = this.postProcessCommits(commit_1.parseConventionalCommits(commits));
|
|
53
|
+
const conventionalCommits = await this.postProcessCommits(commit_1.parseConventionalCommits(commits));
|
|
54
54
|
const newVersion = latestRelease
|
|
55
55
|
? await this.versioningStrategy.bump(latestRelease.tag.version, conventionalCommits)
|
|
56
56
|
: this.initialReleaseVersion();
|
|
@@ -87,7 +87,7 @@ class Python extends base_1.BaseStrategy {
|
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
// There should be only one version.py, but foreach in case that is incorrect
|
|
90
|
-
const versionPyFilesSearch = this.github.
|
|
90
|
+
const versionPyFilesSearch = this.github.findFilesByFilenameAndRef('version.py', this.targetBranch, this.path);
|
|
91
91
|
const versionPyFiles = await versionPyFilesSearch;
|
|
92
92
|
versionPyFiles.forEach(path => {
|
|
93
93
|
updates.push({
|
|
@@ -3,7 +3,7 @@ import { ConventionalCommit } from '../commit';
|
|
|
3
3
|
import { Update } from '../update';
|
|
4
4
|
import { Release } from '../release';
|
|
5
5
|
import { Version } from '../version';
|
|
6
|
-
import {
|
|
6
|
+
import { PullRequestBody } from '../util/pull-request-body';
|
|
7
7
|
interface RubyYoshiStrategyOptions extends BaseStrategyOptions {
|
|
8
8
|
versionFile?: string;
|
|
9
9
|
}
|
|
@@ -11,7 +11,7 @@ export declare class RubyYoshi extends BaseStrategy {
|
|
|
11
11
|
readonly versionFile: string;
|
|
12
12
|
constructor(options: RubyYoshiStrategyOptions);
|
|
13
13
|
protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
|
|
14
|
-
protected postProcessCommits(commits: ConventionalCommit[]): ConventionalCommit[]
|
|
15
|
-
protected
|
|
14
|
+
protected postProcessCommits(commits: ConventionalCommit[]): Promise<ConventionalCommit[]>;
|
|
15
|
+
protected buildPullRequestBody(component: string | undefined, newVersion: Version, releaseNotesBody: string, conventionalCommits: ConventionalCommit[], latestRelease?: Release): Promise<PullRequestBody>;
|
|
16
16
|
}
|
|
17
17
|
export {};
|
|
@@ -24,6 +24,7 @@ const fs_1 = require("fs");
|
|
|
24
24
|
const path_1 = require("path");
|
|
25
25
|
const manifest_1 = require("../manifest");
|
|
26
26
|
const logger_1 = require("../util/logger");
|
|
27
|
+
const pull_request_body_1 = require("../util/pull-request-body");
|
|
27
28
|
const CHANGELOG_SECTIONS = [
|
|
28
29
|
{ type: 'feat', section: 'Features' },
|
|
29
30
|
{ type: 'fix', section: 'Bug Fixes' },
|
|
@@ -73,16 +74,15 @@ class RubyYoshi extends base_1.BaseStrategy {
|
|
|
73
74
|
});
|
|
74
75
|
return updates;
|
|
75
76
|
}
|
|
76
|
-
postProcessCommits(commits) {
|
|
77
|
+
async postProcessCommits(commits) {
|
|
77
78
|
commits.forEach(commit => {
|
|
78
79
|
commit.message = indent_commit_1.indentCommit(commit);
|
|
79
80
|
});
|
|
80
81
|
return commits;
|
|
81
82
|
}
|
|
82
|
-
async
|
|
83
|
-
const releaseNotes = await super.buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease);
|
|
83
|
+
async buildPullRequestBody(component, newVersion, releaseNotesBody, conventionalCommits, latestRelease) {
|
|
84
84
|
if (!latestRelease) {
|
|
85
|
-
return
|
|
85
|
+
return await super.buildPullRequestBody(component, newVersion, releaseNotesBody, conventionalCommits, latestRelease);
|
|
86
86
|
}
|
|
87
87
|
// summarize the commits that landed:
|
|
88
88
|
let summary = '### Commits since last release:\n\n';
|
|
@@ -114,7 +114,15 @@ class RubyYoshi extends base_1.BaseStrategy {
|
|
|
114
114
|
summary += `${file}\n`;
|
|
115
115
|
});
|
|
116
116
|
summary += `</code></pre>\n[Compare Changes](https://github.com/${repoUrl}/compare/${latestRelease.sha}...HEAD)\n`;
|
|
117
|
-
return
|
|
117
|
+
return new pull_request_body_1.PullRequestBody([
|
|
118
|
+
{
|
|
119
|
+
component,
|
|
120
|
+
version: newVersion,
|
|
121
|
+
notes: releaseNotesBody,
|
|
122
|
+
},
|
|
123
|
+
], {
|
|
124
|
+
extra: summary,
|
|
125
|
+
});
|
|
118
126
|
}
|
|
119
127
|
}
|
|
120
128
|
exports.RubyYoshi = RubyYoshi;
|
|
@@ -8,6 +8,6 @@ export declare class Ruby extends BaseStrategy {
|
|
|
8
8
|
readonly versionFile: string;
|
|
9
9
|
constructor(options: RubyStrategyOptions);
|
|
10
10
|
protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
|
|
11
|
-
protected postProcessCommits(commits: ConventionalCommit[]): ConventionalCommit[]
|
|
11
|
+
protected postProcessCommits(commits: ConventionalCommit[]): Promise<ConventionalCommit[]>;
|
|
12
12
|
}
|
|
13
13
|
export {};
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import { BaseStrategy, BuildUpdatesOptions } from './base';
|
|
1
|
+
import { BaseStrategy, BuildUpdatesOptions, BaseStrategyOptions } from './base';
|
|
2
2
|
import { Update } from '../update';
|
|
3
|
+
interface SimpleStrategyOptions extends BaseStrategyOptions {
|
|
4
|
+
versionFile?: string;
|
|
5
|
+
}
|
|
3
6
|
export declare class Simple extends BaseStrategy {
|
|
7
|
+
readonly versionFile: string;
|
|
8
|
+
constructor(options: SimpleStrategyOptions);
|
|
4
9
|
protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
|
|
5
10
|
}
|
|
11
|
+
export {};
|
|
@@ -20,6 +20,11 @@ const changelog_1 = require("../updaters/changelog");
|
|
|
20
20
|
const base_1 = require("./base");
|
|
21
21
|
const default_1 = require("../updaters/default");
|
|
22
22
|
class Simple extends base_1.BaseStrategy {
|
|
23
|
+
constructor(options) {
|
|
24
|
+
var _a;
|
|
25
|
+
super(options);
|
|
26
|
+
this.versionFile = (_a = options.versionFile) !== null && _a !== void 0 ? _a : 'version.txt';
|
|
27
|
+
}
|
|
23
28
|
async buildUpdates(options) {
|
|
24
29
|
const updates = [];
|
|
25
30
|
const version = options.newVersion;
|
|
@@ -32,7 +37,7 @@ class Simple extends base_1.BaseStrategy {
|
|
|
32
37
|
}),
|
|
33
38
|
});
|
|
34
39
|
updates.push({
|
|
35
|
-
path: this.addPath(
|
|
40
|
+
path: this.addPath(this.versionFile),
|
|
36
41
|
createIfMissing: false,
|
|
37
42
|
updater: new default_1.DefaultUpdater({
|
|
38
43
|
version,
|
|
@@ -35,7 +35,7 @@ class TerraformModule extends base_1.BaseStrategy {
|
|
|
35
35
|
});
|
|
36
36
|
// Update version in README to current candidate version.
|
|
37
37
|
// A module may have submodules, so find all submodules.
|
|
38
|
-
const readmeFiles = await this.github.
|
|
38
|
+
const readmeFiles = await this.github.findFilesByFilenameAndRef('readme.md', this.targetBranch, this.path);
|
|
39
39
|
readmeFiles.forEach(path => {
|
|
40
40
|
updates.push({
|
|
41
41
|
path: this.addPath(path),
|
|
@@ -48,8 +48,8 @@ class TerraformModule extends base_1.BaseStrategy {
|
|
|
48
48
|
// Update versions.tf to current candidate version.
|
|
49
49
|
// A module may have submodules, so find all versions.tfand versions.tf.tmpl to update.
|
|
50
50
|
const versionFiles = await Promise.all([
|
|
51
|
-
this.github.
|
|
52
|
-
this.github.
|
|
51
|
+
this.github.findFilesByFilenameAndRef('versions.tf', this.targetBranch, this.path),
|
|
52
|
+
this.github.findFilesByFilenameAndRef('versions.tf.tmpl', this.targetBranch, this.path),
|
|
53
53
|
]).then(([v, vt]) => {
|
|
54
54
|
return v.concat(vt);
|
|
55
55
|
});
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.BranchName = void 0;
|
|
17
17
|
const version_1 = require("../version");
|
|
18
|
+
const logger_1 = require("./logger");
|
|
18
19
|
// cannot import from '..' - transpiled code references to RELEASE_PLEASE
|
|
19
20
|
// at the script level are undefined, they are only defined inside function
|
|
20
21
|
// or instance methods/properties.
|
|
@@ -32,13 +33,19 @@ function getAllResourceNames() {
|
|
|
32
33
|
class BranchName {
|
|
33
34
|
constructor(_branchName) { }
|
|
34
35
|
static parse(branchName) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
try {
|
|
37
|
+
const branchNameClass = getAllResourceNames().find(clazz => {
|
|
38
|
+
return clazz.matches(branchName);
|
|
39
|
+
});
|
|
40
|
+
if (!branchNameClass) {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
return new branchNameClass(branchName);
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
logger_1.logger.warn(`Error parsing branch name: ${branchName}`, e);
|
|
39
47
|
return undefined;
|
|
40
48
|
}
|
|
41
|
-
return new branchNameClass(branchName);
|
|
42
49
|
}
|
|
43
50
|
static ofComponentVersion(branchPrefix, version) {
|
|
44
51
|
return new AutoreleaseBranchName(`release-${branchPrefix}-v${version}`);
|
|
@@ -2,10 +2,12 @@ import { Version } from '../version';
|
|
|
2
2
|
interface PullRequestBodyOptions {
|
|
3
3
|
header?: string;
|
|
4
4
|
footer?: string;
|
|
5
|
+
extra?: string;
|
|
5
6
|
}
|
|
6
7
|
export declare class PullRequestBody {
|
|
7
8
|
header: string;
|
|
8
9
|
footer: string;
|
|
10
|
+
extra?: string;
|
|
9
11
|
releaseData: ReleaseData[];
|
|
10
12
|
constructor(releaseData: ReleaseData[], options?: PullRequestBodyOptions);
|
|
11
13
|
static parse(body: string): PullRequestBody | undefined;
|
|
@@ -24,6 +24,7 @@ class PullRequestBody {
|
|
|
24
24
|
constructor(releaseData, options) {
|
|
25
25
|
this.header = (options === null || options === void 0 ? void 0 : options.header) || DEFAULT_HEADER;
|
|
26
26
|
this.footer = (options === null || options === void 0 ? void 0 : options.footer) || DEFAULT_FOOTER;
|
|
27
|
+
this.extra = options === null || options === void 0 ? void 0 : options.extra;
|
|
27
28
|
this.releaseData = releaseData;
|
|
28
29
|
}
|
|
29
30
|
static parse(body) {
|
|
@@ -63,7 +64,7 @@ ${NOTES_DELIMITER}
|
|
|
63
64
|
|
|
64
65
|
${notes}
|
|
65
66
|
|
|
66
|
-
${NOTES_DELIMITER}
|
|
67
|
+
${NOTES_DELIMITER}${this.extra ? `\n\n${this.extra}\n` : ''}
|
|
67
68
|
${this.footer}`;
|
|
68
69
|
}
|
|
69
70
|
}
|
|
@@ -11,7 +11,7 @@ export declare class PullRequestTitle {
|
|
|
11
11
|
static ofComponentVersion(component: string, version: Version, pullRequestTitlePattern?: string): PullRequestTitle;
|
|
12
12
|
static ofVersion(version: Version, pullRequestTitlePattern?: string): PullRequestTitle;
|
|
13
13
|
static ofTargetBranchVersion(targetBranch: string, version: Version, pullRequestTitlePattern?: string): PullRequestTitle;
|
|
14
|
-
static ofComponentTargetBranchVersion(component
|
|
14
|
+
static ofComponentTargetBranchVersion(component?: string, targetBranch?: string, version?: Version, pullRequestTitlePattern?: string): PullRequestTitle;
|
|
15
15
|
static ofTargetBranch(targetBranch: string, pullRequestTitlePattern?: string): PullRequestTitle;
|
|
16
16
|
getTargetBranch(): string | undefined;
|
|
17
17
|
getComponent(): string | undefined;
|
|
@@ -16,6 +16,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
16
16
|
exports.DefaultVersioningStrategy = void 0;
|
|
17
17
|
const versioning_strategy_1 = require("../versioning-strategy");
|
|
18
18
|
const version_1 = require("../version");
|
|
19
|
+
const logger_1 = require("../util/logger");
|
|
19
20
|
/**
|
|
20
21
|
* This is the default VersioningStrategy for release-please. Breaking
|
|
21
22
|
* changes should bump the major, features should bump the minor, and other
|
|
@@ -48,11 +49,12 @@ class DefaultVersioningStrategy {
|
|
|
48
49
|
// iterate through list of commits and find biggest commit type
|
|
49
50
|
let breaking = 0;
|
|
50
51
|
let features = 0;
|
|
51
|
-
let customVersion;
|
|
52
52
|
for (const commit of commits) {
|
|
53
53
|
const releaseAs = commit.notes.find(note => note.title === 'RELEASE AS');
|
|
54
54
|
if (releaseAs) {
|
|
55
|
-
|
|
55
|
+
// commits are handled newest to oldest, so take the first one (newest) found
|
|
56
|
+
logger_1.logger.debug(`found Release-As: ${releaseAs.text}, forcing version`);
|
|
57
|
+
return new versioning_strategy_1.CustomVersionUpdate(version_1.Version.parse(releaseAs.text).toString());
|
|
56
58
|
}
|
|
57
59
|
if (commit.breaking) {
|
|
58
60
|
breaking++;
|
|
@@ -61,9 +63,6 @@ class DefaultVersioningStrategy {
|
|
|
61
63
|
features++;
|
|
62
64
|
}
|
|
63
65
|
}
|
|
64
|
-
if (customVersion) {
|
|
65
|
-
return new versioning_strategy_1.CustomVersionUpdate(customVersion.toString());
|
|
66
|
-
}
|
|
67
66
|
if (breaking > 0) {
|
|
68
67
|
if (version.major < 1 && this.bumpMinorPreMajor) {
|
|
69
68
|
return new versioning_strategy_1.MinorVersionUpdate();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "release-please",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.4.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",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"node-html-parser": "^5.0.0",
|
|
80
80
|
"parse-github-repo-url": "^1.4.1",
|
|
81
81
|
"semver": "^7.0.0",
|
|
82
|
-
"type-fest": "^
|
|
82
|
+
"type-fest": "^2.0.0",
|
|
83
83
|
"typescript": "^3.8.3",
|
|
84
84
|
"unist-util-visit": "^2.0.3",
|
|
85
85
|
"unist-util-visit-parents": "^3.1.1",
|