release-please 13.1.1 → 13.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/build/src/bin/release-please.d.ts +1 -0
- package/build/src/bin/release-please.js +8 -0
- package/build/src/factory.js +6 -1
- package/build/src/github.d.ts +6 -4
- package/build/src/github.js +30 -29
- package/build/src/manifest.d.ts +6 -1
- package/build/src/manifest.js +11 -5
- package/build/src/strategies/base.d.ts +3 -0
- package/build/src/strategies/base.js +14 -8
- package/build/src/strategies/java-yoshi.d.ts +5 -1
- package/build/src/strategies/java-yoshi.js +23 -19
- package/build/src/strategies/php-yoshi.d.ts +2 -0
- package/build/src/strategies/php-yoshi.js +17 -0
- package/build/src/strategies/ruby-yoshi.d.ts +2 -2
- package/build/src/strategies/ruby-yoshi.js +12 -4
- package/build/src/strategies/simple.d.ts +7 -1
- package/build/src/strategies/simple.js +6 -1
- package/build/src/updaters/java/java-update.d.ts +7 -1
- package/build/src/updaters/java/java-update.js +6 -2
- package/build/src/util/pull-request-body.d.ts +2 -0
- package/build/src/util/pull-request-body.js +3 -2
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,44 @@
|
|
|
4
4
|
|
|
5
5
|
[1]: https://www.npmjs.com/package/release-please?activeTab=versions
|
|
6
6
|
|
|
7
|
+
### [13.3.1](https://github.com/googleapis/release-please/compare/v13.3.0...v13.3.1) (2022-01-12)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* pass target_commitish instead of sha ([#1219](https://github.com/googleapis/release-please/issues/1219)) ([3f26ec3](https://github.com/googleapis/release-please/commit/3f26ec3de527497d7180f2cd987983c6ae6e44cd))
|
|
13
|
+
|
|
14
|
+
## [13.3.0](https://github.com/googleapis/release-please/compare/v13.2.1...v13.3.0) (2022-01-12)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* allow configuring simple strategy version file ([#1168](https://github.com/googleapis/release-please/issues/1168)) ([08a0cf2](https://github.com/googleapis/release-please/commit/08a0cf2b2135713f856d8621cffa8f5b92fb8699))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* 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)
|
|
25
|
+
|
|
26
|
+
### [13.2.1](https://github.com/googleapis/release-please/compare/v13.2.0...v13.2.1) (2022-01-12)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* **php-yoshi:** fix parsing of pull request body ([#1213](https://github.com/googleapis/release-please/issues/1213)) ([00702ca](https://github.com/googleapis/release-please/commit/00702ca575e5d134505280b436e1348eccb2de01))
|
|
32
|
+
|
|
33
|
+
## [13.2.0](https://github.com/googleapis/release-please/compare/v13.1.1...v13.2.0) (2022-01-11)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Features
|
|
37
|
+
|
|
38
|
+
* allow prerelease releases on Github ([#1181](https://github.com/googleapis/release-please/issues/1181)) ([267dbfc](https://github.com/googleapis/release-please/commit/267dbfc58a50cde7ffa378b357df62066a1218c9))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Bug Fixes
|
|
42
|
+
|
|
43
|
+
* java snapshots should update all files with :current annotations ([#1204](https://github.com/googleapis/release-please/issues/1204)) ([6f3ae8b](https://github.com/googleapis/release-please/commit/6f3ae8b58afb6673dab2f49daa3d17fbbbef352c))
|
|
44
|
+
|
|
7
45
|
### [13.1.1](https://www.github.com/googleapis/release-please/compare/v13.1.0...v13.1.1) (2022-01-03)
|
|
8
46
|
|
|
9
47
|
|
|
@@ -76,6 +76,12 @@ function releaseOptions(yargs) {
|
|
|
76
76
|
'tag creation upon "un-drafting" the release.',
|
|
77
77
|
type: 'boolean',
|
|
78
78
|
default: false,
|
|
79
|
+
})
|
|
80
|
+
.option('prerelease', {
|
|
81
|
+
describe: 'mark release that have prerelease versions ' +
|
|
82
|
+
'as as a prerelease on Github',
|
|
83
|
+
type: 'boolean',
|
|
84
|
+
default: false,
|
|
79
85
|
})
|
|
80
86
|
.option('label', {
|
|
81
87
|
default: 'autorelease: pending',
|
|
@@ -316,6 +322,7 @@ const createReleaseCommand = {
|
|
|
316
322
|
component: argv.component,
|
|
317
323
|
packageName: argv.packageName,
|
|
318
324
|
draft: argv.draft,
|
|
325
|
+
prerelease: argv.prerelease,
|
|
319
326
|
includeComponentInTag: argv.monorepoTags,
|
|
320
327
|
}, extractManifestOptions(argv), argv.path);
|
|
321
328
|
}
|
|
@@ -419,6 +426,7 @@ const bootstrapCommand = {
|
|
|
419
426
|
component: argv.component,
|
|
420
427
|
packageName: argv.packageName,
|
|
421
428
|
draft: argv.draft,
|
|
429
|
+
prerelease: argv.prerelease,
|
|
422
430
|
draftPullRequest: argv.draftPullRequest,
|
|
423
431
|
bumpMinorPreMajor: argv.bumpMinorPreMajor,
|
|
424
432
|
bumpPatchForMinorPreMajor: argv.bumpPatchForMinorPreMajor,
|
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.d.ts
CHANGED
|
@@ -46,6 +46,10 @@ interface ReleaseIteratorOptions {
|
|
|
46
46
|
interface TagIteratorOptions {
|
|
47
47
|
maxResults?: number;
|
|
48
48
|
}
|
|
49
|
+
export interface ReleaseOptions {
|
|
50
|
+
draft?: boolean;
|
|
51
|
+
prerelease?: boolean;
|
|
52
|
+
}
|
|
49
53
|
export interface GitHubRelease {
|
|
50
54
|
name?: string;
|
|
51
55
|
tagName: string;
|
|
@@ -306,13 +310,11 @@ export declare class GitHub {
|
|
|
306
310
|
* Create a GitHub release
|
|
307
311
|
*
|
|
308
312
|
* @param {Release} release Release parameters
|
|
309
|
-
* @param {
|
|
313
|
+
* @param {ReleaseOptions} options Release option parameters
|
|
310
314
|
* @throws {DuplicateReleaseError} if the release tag already exists
|
|
311
315
|
* @throws {GitHubAPIError} on other API errors
|
|
312
316
|
*/
|
|
313
|
-
createRelease: (release: Release, options?:
|
|
314
|
-
draft?: boolean | undefined;
|
|
315
|
-
} | undefined) => Promise<GitHubRelease>;
|
|
317
|
+
createRelease: (release: Release, options?: ReleaseOptions | undefined) => Promise<GitHubRelease>;
|
|
316
318
|
/**
|
|
317
319
|
* Makes a comment on a issue/pull request.
|
|
318
320
|
*
|
package/build/src/github.js
CHANGED
|
@@ -293,7 +293,7 @@ class GitHub {
|
|
|
293
293
|
* Create a GitHub release
|
|
294
294
|
*
|
|
295
295
|
* @param {Release} release Release parameters
|
|
296
|
-
* @param {
|
|
296
|
+
* @param {ReleaseOptions} options Release option parameters
|
|
297
297
|
* @throws {DuplicateReleaseError} if the release tag already exists
|
|
298
298
|
* @throws {GitHubAPIError} on other API errors
|
|
299
299
|
*/
|
|
@@ -304,8 +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,
|
|
308
|
+
prerelease: !!options.prerelease,
|
|
309
|
+
target_commitish: release.sha,
|
|
309
310
|
});
|
|
310
311
|
return {
|
|
311
312
|
name: resp.data.name || undefined,
|
|
@@ -651,39 +652,39 @@ class GitHub {
|
|
|
651
652
|
logger_1.logger.debug(`Fetching ${states} pull requests on branch ${targetBranch} with cursor ${cursor}`);
|
|
652
653
|
const response = await this.graphqlRequest({
|
|
653
654
|
query: `query mergedPullRequests($owner: String!, $repo: String!, $num: Int!, $maxFilesChanged: Int, $targetBranch: String!, $states: [PullRequestState!], $cursor: String) {
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
}
|
|
655
|
+
repository(owner: $owner, name: $repo) {
|
|
656
|
+
pullRequests(first: $num, after: $cursor, baseRefName: $targetBranch, states: $states, orderBy: {field: CREATED_AT, direction: DESC}) {
|
|
657
|
+
nodes {
|
|
658
|
+
number
|
|
659
|
+
title
|
|
660
|
+
baseRefName
|
|
661
|
+
headRefName
|
|
662
|
+
labels(first: 10) {
|
|
663
|
+
nodes {
|
|
664
|
+
name
|
|
665
665
|
}
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
666
|
+
}
|
|
667
|
+
body
|
|
668
|
+
mergeCommit {
|
|
669
|
+
oid
|
|
670
|
+
}
|
|
671
|
+
files(first: $maxFilesChanged) {
|
|
672
|
+
nodes {
|
|
673
|
+
path
|
|
669
674
|
}
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
}
|
|
674
|
-
pageInfo {
|
|
675
|
-
endCursor
|
|
676
|
-
hasNextPage
|
|
677
|
-
}
|
|
675
|
+
pageInfo {
|
|
676
|
+
endCursor
|
|
677
|
+
hasNextPage
|
|
678
678
|
}
|
|
679
679
|
}
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
680
|
+
}
|
|
681
|
+
pageInfo {
|
|
682
|
+
endCursor
|
|
683
|
+
hasNextPage
|
|
684
684
|
}
|
|
685
685
|
}
|
|
686
|
-
}
|
|
686
|
+
}
|
|
687
|
+
}`,
|
|
687
688
|
cursor,
|
|
688
689
|
owner: this.repository.owner,
|
|
689
690
|
repo: this.repository.repo,
|
package/build/src/manifest.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export interface ReleaserConfig {
|
|
|
16
16
|
releaseAs?: string;
|
|
17
17
|
skipGithubRelease?: boolean;
|
|
18
18
|
draft?: boolean;
|
|
19
|
+
prerelease?: boolean;
|
|
19
20
|
draftPullRequest?: boolean;
|
|
20
21
|
component?: string;
|
|
21
22
|
packageName?: string;
|
|
@@ -34,8 +35,9 @@ export interface CandidateReleasePullRequest {
|
|
|
34
35
|
}
|
|
35
36
|
export interface CandidateRelease extends Release {
|
|
36
37
|
pullRequest: PullRequest;
|
|
37
|
-
draft?: boolean;
|
|
38
38
|
path: string;
|
|
39
|
+
draft?: boolean;
|
|
40
|
+
prerelease?: boolean;
|
|
39
41
|
}
|
|
40
42
|
interface ReleaserConfigJson {
|
|
41
43
|
'release-type'?: ReleaseType;
|
|
@@ -45,6 +47,7 @@ interface ReleaserConfigJson {
|
|
|
45
47
|
'release-as'?: string;
|
|
46
48
|
'skip-github-release'?: boolean;
|
|
47
49
|
draft?: boolean;
|
|
50
|
+
prerelease?: boolean;
|
|
48
51
|
'draft-pull-request'?: boolean;
|
|
49
52
|
label?: string;
|
|
50
53
|
'release-label'?: string;
|
|
@@ -66,6 +69,7 @@ export interface ManifestOptions {
|
|
|
66
69
|
labels?: string[];
|
|
67
70
|
releaseLabels?: string[];
|
|
68
71
|
draft?: boolean;
|
|
72
|
+
prerelease?: boolean;
|
|
69
73
|
draftPullRequest?: boolean;
|
|
70
74
|
}
|
|
71
75
|
interface ReleaserPackageConfig extends ReleaserConfigJson {
|
|
@@ -116,6 +120,7 @@ export declare class Manifest {
|
|
|
116
120
|
private bootstrapSha?;
|
|
117
121
|
private lastReleaseSha?;
|
|
118
122
|
private draft?;
|
|
123
|
+
private prerelease?;
|
|
119
124
|
private draftPullRequest?;
|
|
120
125
|
/**
|
|
121
126
|
* Create a Manifest from explicit config in code. This assumes that the
|
package/build/src/manifest.js
CHANGED
|
@@ -439,6 +439,9 @@ class Manifest {
|
|
|
439
439
|
path,
|
|
440
440
|
pullRequest,
|
|
441
441
|
draft: (_a = config.draft) !== null && _a !== void 0 ? _a : this.draft,
|
|
442
|
+
prerelease: config.prerelease &&
|
|
443
|
+
(!!release.tag.version.preRelease ||
|
|
444
|
+
release.tag.version.major === 0),
|
|
442
445
|
});
|
|
443
446
|
}
|
|
444
447
|
}
|
|
@@ -488,6 +491,7 @@ class Manifest {
|
|
|
488
491
|
async createRelease(release) {
|
|
489
492
|
const githubRelease = await this.github.createRelease(release, {
|
|
490
493
|
draft: release.draft,
|
|
494
|
+
prerelease: release.prerelease,
|
|
491
495
|
});
|
|
492
496
|
// comment on pull request
|
|
493
497
|
const comment = `:robot: Release is at ${githubRelease.url} :sunflower:`;
|
|
@@ -553,6 +557,7 @@ function extractReleaserConfig(config) {
|
|
|
553
557
|
releaseAs: config['release-as'],
|
|
554
558
|
skipGithubRelease: config['skip-github-release'],
|
|
555
559
|
draft: config.draft,
|
|
560
|
+
prerelease: config.prerelease,
|
|
556
561
|
draftPullRequest: config['draft-pull-request'],
|
|
557
562
|
component: config['component'],
|
|
558
563
|
packageName: config['package-name'],
|
|
@@ -696,7 +701,7 @@ async function latestReleaseVersion(github, targetBranch, prefix, pullRequestTit
|
|
|
696
701
|
return candidateTagVersion.sort((a, b) => b.compare(a))[0];
|
|
697
702
|
}
|
|
698
703
|
function mergeReleaserConfig(defaultConfig, pathConfig) {
|
|
699
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
704
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
700
705
|
return {
|
|
701
706
|
releaseType: (_b = (_a = pathConfig.releaseType) !== null && _a !== void 0 ? _a : defaultConfig.releaseType) !== null && _b !== void 0 ? _b : 'node',
|
|
702
707
|
bumpMinorPreMajor: (_c = pathConfig.bumpMinorPreMajor) !== null && _c !== void 0 ? _c : defaultConfig.bumpMinorPreMajor,
|
|
@@ -706,10 +711,11 @@ function mergeReleaserConfig(defaultConfig, pathConfig) {
|
|
|
706
711
|
releaseAs: (_g = pathConfig.releaseAs) !== null && _g !== void 0 ? _g : defaultConfig.releaseAs,
|
|
707
712
|
skipGithubRelease: (_h = pathConfig.skipGithubRelease) !== null && _h !== void 0 ? _h : defaultConfig.skipGithubRelease,
|
|
708
713
|
draft: (_j = pathConfig.draft) !== null && _j !== void 0 ? _j : defaultConfig.draft,
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
714
|
+
prerelease: (_k = pathConfig.prerelease) !== null && _k !== void 0 ? _k : defaultConfig.prerelease,
|
|
715
|
+
component: (_l = pathConfig.component) !== null && _l !== void 0 ? _l : defaultConfig.component,
|
|
716
|
+
packageName: (_m = pathConfig.packageName) !== null && _m !== void 0 ? _m : defaultConfig.packageName,
|
|
717
|
+
versionFile: (_o = pathConfig.versionFile) !== null && _o !== void 0 ? _o : defaultConfig.versionFile,
|
|
718
|
+
extraFiles: (_p = pathConfig.extraFiles) !== null && _p !== void 0 ? _p : defaultConfig.extraFiles,
|
|
713
719
|
};
|
|
714
720
|
}
|
|
715
721
|
/**
|
|
@@ -9,6 +9,7 @@ import { Version, VersionsMap } from '../version';
|
|
|
9
9
|
import { TagName } from '../util/tag-name';
|
|
10
10
|
import { Release } from '../release';
|
|
11
11
|
import { ReleasePullRequest } from '../release-pull-request';
|
|
12
|
+
import { PullRequestBody } from '../util/pull-request-body';
|
|
12
13
|
import { PullRequest } from '../pull-request';
|
|
13
14
|
export interface BuildUpdatesOptions {
|
|
14
15
|
changelogEntry: string;
|
|
@@ -80,6 +81,7 @@ export declare abstract class BaseStrategy implements Strategy {
|
|
|
80
81
|
*/
|
|
81
82
|
protected postProcessCommits(commits: ConventionalCommit[]): ConventionalCommit[];
|
|
82
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>;
|
|
83
85
|
/**
|
|
84
86
|
* Builds a candidate release pull request
|
|
85
87
|
* @param {Commit[]} commits Raw commits to consider for this release.
|
|
@@ -97,6 +99,7 @@ export declare abstract class BaseStrategy implements Strategy {
|
|
|
97
99
|
protected updateVersionsMap(versionsMap: VersionsMap, conventionalCommits: ConventionalCommit[]): Promise<VersionsMap>;
|
|
98
100
|
protected buildNewVersion(conventionalCommits: ConventionalCommit[], latestRelease?: Release): Promise<Version>;
|
|
99
101
|
protected buildVersionsMap(_conventionalCommits: ConventionalCommit[]): Promise<VersionsMap>;
|
|
102
|
+
protected parsePullRequestBody(pullRequestBody: string): Promise<PullRequestBody | undefined>;
|
|
100
103
|
/**
|
|
101
104
|
* Given a merged pull request, build the candidate release.
|
|
102
105
|
* @param {PullRequest} mergedPullRequest The merged release pull request.
|
|
@@ -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.
|
|
@@ -131,13 +140,7 @@ class BaseStrategy {
|
|
|
131
140
|
latestVersion: latestRelease === null || latestRelease === void 0 ? void 0 : latestRelease.tag.version,
|
|
132
141
|
});
|
|
133
142
|
const updatesWithExtras = composite_1.mergeUpdates(updates.concat(...this.extraFileUpdates(newVersion)));
|
|
134
|
-
const pullRequestBody =
|
|
135
|
-
{
|
|
136
|
-
component,
|
|
137
|
-
version: newVersion,
|
|
138
|
-
notes: releaseNotesBody,
|
|
139
|
-
},
|
|
140
|
-
]);
|
|
143
|
+
const pullRequestBody = await this.buildPullRequestBody(component, newVersion, releaseNotesBody, conventionalCommits, latestRelease);
|
|
141
144
|
return {
|
|
142
145
|
title: pullRequestTitle,
|
|
143
146
|
body: pullRequestBody,
|
|
@@ -188,6 +191,9 @@ class BaseStrategy {
|
|
|
188
191
|
async buildVersionsMap(_conventionalCommits) {
|
|
189
192
|
return new Map();
|
|
190
193
|
}
|
|
194
|
+
async parsePullRequestBody(pullRequestBody) {
|
|
195
|
+
return pull_request_body_1.PullRequestBody.parse(pullRequestBody);
|
|
196
|
+
}
|
|
191
197
|
/**
|
|
192
198
|
* Given a merged pull request, build the candidate release.
|
|
193
199
|
* @param {PullRequest} mergedPullRequest The merged release pull request.
|
|
@@ -213,7 +219,7 @@ class BaseStrategy {
|
|
|
213
219
|
logger_1.logger.error(`Bad branch name: ${mergedPullRequest.headBranchName}`);
|
|
214
220
|
return;
|
|
215
221
|
}
|
|
216
|
-
const pullRequestBody =
|
|
222
|
+
const pullRequestBody = await this.parsePullRequestBody(mergedPullRequest.body);
|
|
217
223
|
if (!pullRequestBody) {
|
|
218
224
|
logger_1.logger.error('Could not parse pull request body as a release PR');
|
|
219
225
|
return;
|
|
@@ -5,6 +5,9 @@ import { GitHubFileContents } from '../github';
|
|
|
5
5
|
import { Commit, ConventionalCommit } from '../commit';
|
|
6
6
|
import { Release } from '../release';
|
|
7
7
|
import { ReleasePullRequest } from '../release-pull-request';
|
|
8
|
+
interface JavaBuildUpdatesOption extends BuildUpdatesOptions {
|
|
9
|
+
isSnapshot?: boolean;
|
|
10
|
+
}
|
|
8
11
|
export declare class JavaYoshi extends BaseStrategy {
|
|
9
12
|
private versionsContent?;
|
|
10
13
|
private snapshotVersioning;
|
|
@@ -14,7 +17,8 @@ export declare class JavaYoshi extends BaseStrategy {
|
|
|
14
17
|
private needsSnapshot;
|
|
15
18
|
protected buildVersionsMap(): Promise<VersionsMap>;
|
|
16
19
|
protected getVersionsContent(): Promise<GitHubFileContents>;
|
|
17
|
-
protected buildUpdates(options:
|
|
20
|
+
protected buildUpdates(options: JavaBuildUpdatesOption): Promise<Update[]>;
|
|
18
21
|
protected updateVersionsMap(versionsMap: VersionsMap, conventionalCommits: ConventionalCommit[]): Promise<VersionsMap>;
|
|
19
22
|
protected initialReleaseVersion(): Version;
|
|
20
23
|
}
|
|
24
|
+
export {};
|
|
@@ -78,26 +78,24 @@ class JavaYoshi extends base_1.BaseStrategy {
|
|
|
78
78
|
const branchName = component
|
|
79
79
|
? branch_name_1.BranchName.ofComponentTargetBranch(component, this.targetBranch)
|
|
80
80
|
: branch_name_1.BranchName.ofTargetBranch(this.targetBranch);
|
|
81
|
+
const notes = '### Updating meta-information for bleeding-edge SNAPSHOT release.';
|
|
81
82
|
const pullRequestBody = new pull_request_body_1.PullRequestBody([
|
|
82
83
|
{
|
|
83
84
|
component,
|
|
84
85
|
version: newVersion,
|
|
85
|
-
notes
|
|
86
|
+
notes,
|
|
86
87
|
},
|
|
87
88
|
]);
|
|
89
|
+
const updates = await this.buildUpdates({
|
|
90
|
+
newVersion,
|
|
91
|
+
versionsMap,
|
|
92
|
+
changelogEntry: notes,
|
|
93
|
+
isSnapshot: true,
|
|
94
|
+
});
|
|
88
95
|
return {
|
|
89
96
|
title: pullRequestTitle,
|
|
90
97
|
body: pullRequestBody,
|
|
91
|
-
updates
|
|
92
|
-
{
|
|
93
|
-
path: this.addPath('versions.txt'),
|
|
94
|
-
createIfMissing: false,
|
|
95
|
-
updater: new versions_manifest_1.VersionsManifest({
|
|
96
|
-
version: newVersion,
|
|
97
|
-
versionsMap,
|
|
98
|
-
}),
|
|
99
|
-
},
|
|
100
|
-
],
|
|
98
|
+
updates,
|
|
101
99
|
labels: [],
|
|
102
100
|
headRefName: branchName.toString(),
|
|
103
101
|
version: newVersion,
|
|
@@ -149,6 +147,7 @@ class JavaYoshi extends base_1.BaseStrategy {
|
|
|
149
147
|
updater: new java_update_1.JavaUpdate({
|
|
150
148
|
version,
|
|
151
149
|
versionsMap,
|
|
150
|
+
isSnapshot: options.isSnapshot,
|
|
152
151
|
}),
|
|
153
152
|
});
|
|
154
153
|
});
|
|
@@ -160,6 +159,7 @@ class JavaYoshi extends base_1.BaseStrategy {
|
|
|
160
159
|
updater: new java_update_1.JavaUpdate({
|
|
161
160
|
version,
|
|
162
161
|
versionsMap,
|
|
162
|
+
isSnapshot: options.isSnapshot,
|
|
163
163
|
}),
|
|
164
164
|
});
|
|
165
165
|
});
|
|
@@ -171,6 +171,7 @@ class JavaYoshi extends base_1.BaseStrategy {
|
|
|
171
171
|
updater: new java_update_1.JavaUpdate({
|
|
172
172
|
version,
|
|
173
173
|
versionsMap,
|
|
174
|
+
isSnapshot: options.isSnapshot,
|
|
174
175
|
}),
|
|
175
176
|
});
|
|
176
177
|
});
|
|
@@ -181,17 +182,20 @@ class JavaYoshi extends base_1.BaseStrategy {
|
|
|
181
182
|
updater: new java_update_1.JavaUpdate({
|
|
182
183
|
version,
|
|
183
184
|
versionsMap,
|
|
185
|
+
isSnapshot: options.isSnapshot,
|
|
184
186
|
}),
|
|
185
187
|
});
|
|
186
188
|
});
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
189
|
+
if (!options.isSnapshot) {
|
|
190
|
+
updates.push({
|
|
191
|
+
path: this.addPath(this.changelogPath),
|
|
192
|
+
createIfMissing: true,
|
|
193
|
+
updater: new changelog_1.Changelog({
|
|
194
|
+
version,
|
|
195
|
+
changelogEntry: options.changelogEntry,
|
|
196
|
+
}),
|
|
197
|
+
});
|
|
198
|
+
}
|
|
195
199
|
return updates;
|
|
196
200
|
}
|
|
197
201
|
async updateVersionsMap(versionsMap, conventionalCommits) {
|
|
@@ -3,8 +3,10 @@ import { Update } from '../update';
|
|
|
3
3
|
import { Commit } from '../commit';
|
|
4
4
|
import { Release } from '../release';
|
|
5
5
|
import { ReleasePullRequest } from '../release-pull-request';
|
|
6
|
+
import { PullRequestBody } from '../util/pull-request-body';
|
|
6
7
|
export declare class PHPYoshi extends BaseStrategy {
|
|
7
8
|
constructor(options: BaseStrategyOptions);
|
|
8
9
|
buildReleasePullRequest(commits: Commit[], latestRelease?: Release, draft?: boolean, labels?: string[]): Promise<ReleasePullRequest>;
|
|
10
|
+
protected parsePullRequestBody(pullRequestBody: string): Promise<PullRequestBody | undefined>;
|
|
9
11
|
protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
|
|
10
12
|
}
|
|
@@ -146,6 +146,23 @@ class PHPYoshi extends base_1.BaseStrategy {
|
|
|
146
146
|
draft: draft !== null && draft !== void 0 ? draft : false,
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
|
+
async parsePullRequestBody(pullRequestBody) {
|
|
150
|
+
const body = pull_request_body_1.PullRequestBody.parse(pullRequestBody);
|
|
151
|
+
if (!body) {
|
|
152
|
+
return undefined;
|
|
153
|
+
}
|
|
154
|
+
const component = await this.getComponent();
|
|
155
|
+
const notes = body.releaseData
|
|
156
|
+
.map(release => {
|
|
157
|
+
var _a;
|
|
158
|
+
return `<details><summary>${release.component}: ${(_a = release.version) === null || _a === void 0 ? void 0 : _a.toString()}</summary>\n\n${release.notes}\n</details>`;
|
|
159
|
+
})
|
|
160
|
+
.join('\n\n');
|
|
161
|
+
return new pull_request_body_1.PullRequestBody([{ component, notes }], {
|
|
162
|
+
footer: body.footer,
|
|
163
|
+
header: body.header,
|
|
164
|
+
});
|
|
165
|
+
}
|
|
149
166
|
async buildUpdates(options) {
|
|
150
167
|
const updates = [];
|
|
151
168
|
const version = options.newVersion;
|
|
@@ -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
|
}
|
|
@@ -12,6 +12,6 @@ export declare class RubyYoshi extends BaseStrategy {
|
|
|
12
12
|
constructor(options: RubyYoshiStrategyOptions);
|
|
13
13
|
protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
|
|
14
14
|
protected postProcessCommits(commits: ConventionalCommit[]): ConventionalCommit[];
|
|
15
|
-
protected
|
|
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' },
|
|
@@ -79,10 +80,9 @@ class RubyYoshi extends base_1.BaseStrategy {
|
|
|
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;
|
|
@@ -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,
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import { DefaultUpdater } from '../default';
|
|
1
|
+
import { DefaultUpdater, UpdateOptions } from '../default';
|
|
2
|
+
interface JavaUpdateOptions extends UpdateOptions {
|
|
3
|
+
isSnapshot?: boolean;
|
|
4
|
+
}
|
|
2
5
|
/**
|
|
3
6
|
* Updates a file annotated with region markers. These region markers are
|
|
4
7
|
* either denoted inline with `{x-version-update:<component-name>:current|released}`
|
|
5
8
|
* or with a `{x-version-update-start:<component-name>}` and `{x-version-update-end}`.
|
|
6
9
|
*/
|
|
7
10
|
export declare class JavaUpdate extends DefaultUpdater {
|
|
11
|
+
isSnapshot: boolean;
|
|
12
|
+
constructor(options: JavaUpdateOptions);
|
|
8
13
|
/**
|
|
9
14
|
* Given initial file contents, return updated contents.
|
|
10
15
|
* @param {string} content The initial content
|
|
@@ -12,3 +17,4 @@ export declare class JavaUpdate extends DefaultUpdater {
|
|
|
12
17
|
*/
|
|
13
18
|
updateContent(content: string): string;
|
|
14
19
|
}
|
|
20
|
+
export {};
|
|
@@ -26,6 +26,10 @@ const VERSION_REGEX = /\d+\.\d+\.\d+(-\w+(\.\d+)?)?(-SNAPSHOT)?/;
|
|
|
26
26
|
* or with a `{x-version-update-start:<component-name>}` and `{x-version-update-end}`.
|
|
27
27
|
*/
|
|
28
28
|
class JavaUpdate extends default_1.DefaultUpdater {
|
|
29
|
+
constructor(options) {
|
|
30
|
+
super(options);
|
|
31
|
+
this.isSnapshot = !!options.isSnapshot;
|
|
32
|
+
}
|
|
29
33
|
/**
|
|
30
34
|
* Given initial file contents, return updated contents.
|
|
31
35
|
* @param {string} content The initial content
|
|
@@ -40,7 +44,7 @@ class JavaUpdate extends default_1.DefaultUpdater {
|
|
|
40
44
|
let blockPackageName = null;
|
|
41
45
|
content.split(/\r?\n/).forEach(line => {
|
|
42
46
|
let match = line.match(INLINE_UPDATE_REGEX);
|
|
43
|
-
if (match) {
|
|
47
|
+
if (match && (!this.isSnapshot || match[2] === 'current')) {
|
|
44
48
|
const newVersion = this.versionsMap.get(match[1]);
|
|
45
49
|
if (newVersion) {
|
|
46
50
|
newLines.push(line.replace(VERSION_REGEX, newVersion.toString()));
|
|
@@ -63,7 +67,7 @@ class JavaUpdate extends default_1.DefaultUpdater {
|
|
|
63
67
|
}
|
|
64
68
|
else {
|
|
65
69
|
match = line.match(BLOCK_START_REGEX);
|
|
66
|
-
if (match) {
|
|
70
|
+
if (match && (!this.isSnapshot || match[2] === 'current')) {
|
|
67
71
|
blockPackageName = match[1];
|
|
68
72
|
}
|
|
69
73
|
newLines.push(line);
|
|
@@ -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
|
}
|
|
@@ -87,7 +88,7 @@ function splitBody(body) {
|
|
|
87
88
|
content,
|
|
88
89
|
};
|
|
89
90
|
}
|
|
90
|
-
const SUMMARY_PATTERN = /^(?<component>.*)
|
|
91
|
+
const SUMMARY_PATTERN = /^(?<component>.*[^:]):? (?<version>\d+\.\d+\.\d+.*)$/;
|
|
91
92
|
function extractMultipleReleases(notes) {
|
|
92
93
|
const data = [];
|
|
93
94
|
const root = node_html_parser_1.parse(notes);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "release-please",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.3.1",
|
|
4
4
|
"description": "generate release PRs based on the conventionalcommits.org spec",
|
|
5
5
|
"main": "./build/src/index.js",
|
|
6
6
|
"bin": "./build/src/bin/release-please.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
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/mocha": "^
|
|
44
|
+
"@types/mocha": "^9.0.0",
|
|
45
45
|
"@types/node": "^16.0.0",
|
|
46
46
|
"@types/pino": "^7.0.0",
|
|
47
47
|
"@types/semver": "^7.0.0",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"c8": "^7.0.0",
|
|
51
51
|
"chai": "^4.2.0",
|
|
52
52
|
"cross-env": "^7.0.0",
|
|
53
|
-
"gts": "^
|
|
54
|
-
"mocha": "^
|
|
53
|
+
"gts": "^3.0.0",
|
|
54
|
+
"mocha": "^9.0.0",
|
|
55
55
|
"nock": "^13.0.0",
|
|
56
56
|
"sinon": "12.0.1",
|
|
57
57
|
"snap-shot-it": "^7.0.0"
|