release-please 12.3.0 → 13.0.0-candidate.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 +21 -0
- package/README.md +5 -0
- package/build/src/bin/release-please.d.ts +51 -11
- package/build/src/bin/release-please.js +409 -150
- package/build/src/bootstrapper.d.ts +12 -0
- package/build/src/bootstrapper.js +60 -0
- package/build/src/commit.d.ts +26 -0
- package/build/src/{util/to-conventional-changelog-format.js → commit.js} +97 -2
- package/build/src/errors/index.d.ts +0 -5
- package/build/src/errors/index.js +1 -10
- package/build/src/factory.d.ts +25 -37
- package/build/src/factory.js +159 -150
- package/build/src/github.d.ts +151 -883
- package/build/src/github.js +584 -1013
- package/build/src/manifest.d.ts +177 -48
- package/build/src/manifest.js +583 -487
- package/build/src/plugin.d.ts +20 -0
- package/build/src/{plugins/plugin.js → plugin.js} +10 -9
- package/build/src/plugins/cargo-workspace.d.ts +48 -18
- package/build/src/plugins/cargo-workspace.js +247 -328
- package/build/src/plugins/merge.d.ts +11 -0
- package/build/src/plugins/merge.js +83 -0
- package/build/src/plugins/node-workspace.d.ts +35 -17
- package/build/src/plugins/node-workspace.js +234 -271
- package/build/src/plugins/workspace.d.ts +102 -0
- package/build/src/plugins/workspace.js +170 -0
- package/build/src/pull-request.d.ts +10 -0
- package/build/src/{updaters/java/readme.js → pull-request.js} +2 -7
- package/build/src/release-notes.d.ts +29 -0
- package/build/src/release-notes.js +71 -0
- package/build/src/release-pull-request.d.ts +13 -0
- package/build/src/{updaters/java/pom-xml.js → release-pull-request.js} +2 -7
- package/build/src/release.d.ts +6 -0
- package/build/src/release.js +16 -0
- package/build/src/repository.d.ts +5 -0
- package/build/src/repository.js +16 -0
- package/build/src/strategies/dart.d.ts +8 -0
- package/build/src/strategies/dart.js +63 -0
- package/build/src/strategies/elixir.d.ts +5 -0
- package/build/src/{releasers → strategies}/elixir.js +18 -14
- package/build/src/strategies/go-yoshi.d.ts +13 -0
- package/build/src/strategies/go-yoshi.js +106 -0
- package/build/src/strategies/go.d.ts +5 -0
- package/build/src/{releasers → strategies}/go.js +11 -12
- package/build/src/strategies/helm.d.ts +8 -0
- package/build/src/strategies/helm.js +63 -0
- package/build/src/strategies/java-yoshi.d.ts +24 -0
- package/build/src/strategies/java-yoshi.js +203 -0
- package/build/src/strategies/krm-blueprint.d.ts +7 -0
- package/build/src/{releasers → strategies}/krm-blueprint.js +26 -22
- package/build/src/strategies/node.d.ts +9 -0
- package/build/src/strategies/node.js +82 -0
- package/build/src/strategies/ocaml.d.ts +5 -0
- package/build/src/{releasers → strategies}/ocaml.js +34 -28
- package/build/src/strategies/php-yoshi.d.ts +9 -0
- package/build/src/strategies/php-yoshi.js +214 -0
- package/build/src/strategies/php.d.ts +6 -0
- package/build/src/{releasers → strategies}/php.js +24 -23
- package/build/src/strategies/python.d.ts +8 -0
- package/build/src/strategies/python.js +117 -0
- package/build/src/strategies/ruby-yoshi.d.ts +17 -0
- package/build/src/strategies/ruby-yoshi.js +116 -0
- package/build/src/strategies/ruby.d.ts +13 -0
- package/build/src/{releasers → strategies}/ruby.js +26 -27
- package/build/src/strategies/rust.d.ts +20 -0
- package/build/src/strategies/rust.js +120 -0
- package/build/src/strategies/simple.d.ts +5 -0
- package/build/src/{releasers → strategies}/simple.js +18 -14
- package/build/src/strategies/terraform-module.d.ts +7 -0
- package/build/src/{releasers → strategies}/terraform-module.js +29 -23
- package/build/src/strategy.d.ts +99 -0
- package/build/src/strategy.js +237 -0
- package/build/src/update.d.ts +23 -0
- package/build/src/{updaters/update.js → update.js} +1 -1
- package/build/src/updaters/changelog.d.ts +7 -10
- package/build/src/updaters/changelog.js +3 -9
- package/build/src/updaters/changelog.js.map +1 -1
- package/build/src/updaters/composite.d.ts +19 -0
- package/build/src/updaters/composite.js +42 -0
- package/build/src/updaters/dart/pubspec-yaml.d.ts +12 -0
- package/build/src/updaters/dart/pubspec-yaml.js +45 -0
- package/build/src/updaters/default.d.ts +21 -0
- package/build/src/updaters/{version-txt.js → default.js} +16 -10
- package/build/src/updaters/dotnet/csproj.d.ts +12 -0
- package/build/src/updaters/{java/google-utils.js → dotnet/csproj.js} +16 -13
- package/build/src/updaters/elixir/elixir-mix-exs.d.ts +12 -0
- package/build/src/updaters/{elixir-mix-exs.js → elixir/elixir-mix-exs.js} +12 -10
- package/build/src/updaters/helm/chart-yaml.d.ts +10 -11
- package/build/src/updaters/helm/chart-yaml.js +12 -10
- package/build/src/updaters/java/java-update.d.ts +14 -0
- package/build/src/updaters/java/{java_update.js → java-update.js} +22 -22
- package/build/src/updaters/java/versions-manifest.d.ts +12 -2
- package/build/src/updaters/java/versions-manifest.js +20 -4
- package/build/src/updaters/krm/krm-blueprint-version.d.ts +10 -11
- package/build/src/updaters/krm/krm-blueprint-version.js +13 -12
- package/build/src/updaters/node/package-json.d.ts +12 -0
- package/build/src/updaters/{package-json.js → node/package-json.js} +14 -16
- package/build/src/updaters/node/package-lock-json.d.ts +8 -0
- package/build/src/updaters/node/package-lock-json.js +36 -0
- package/build/src/updaters/node/samples-package-json.d.ts +23 -0
- package/build/src/updaters/{samples-package-json.js → node/samples-package-json.js} +19 -8
- package/build/src/updaters/ocaml/dune-project.d.ts +10 -11
- package/build/src/updaters/ocaml/dune-project.js +11 -9
- package/build/src/updaters/ocaml/esy-json.d.ts +10 -11
- package/build/src/updaters/ocaml/esy-json.js +12 -10
- package/build/src/updaters/ocaml/opam.d.ts +10 -11
- package/build/src/updaters/ocaml/opam.js +11 -9
- package/build/src/updaters/php/php-client-version.d.ts +12 -0
- package/build/src/updaters/{php-client-version.js → php/php-client-version.js} +10 -9
- package/build/src/updaters/php/php-manifest.d.ts +13 -0
- package/build/src/updaters/{php-manifest.js → php/php-manifest.js} +17 -15
- package/build/src/updaters/php/root-composer-update-packages.d.ts +12 -0
- package/build/src/updaters/{root-composer-update-packages.js → php/root-composer-update-packages.js} +17 -16
- package/build/src/updaters/python/pyproject-toml.d.ts +10 -11
- package/build/src/updaters/python/pyproject-toml.js +13 -11
- package/build/src/updaters/python/python-file-with-version.d.ts +7 -11
- package/build/src/updaters/python/python-file-with-version.js +7 -8
- package/build/src/updaters/python/setup-cfg.d.ts +10 -11
- package/build/src/updaters/python/setup-cfg.js +10 -8
- package/build/src/updaters/python/setup-py.d.ts +10 -11
- package/build/src/updaters/python/setup-py.js +10 -8
- package/build/src/updaters/raw-content.d.ts +19 -0
- package/build/src/{plugins/index.js → updaters/raw-content.js} +23 -12
- package/build/src/updaters/release-please-config.d.ts +8 -0
- package/build/src/updaters/release-please-config.js +41 -0
- package/build/src/updaters/release-please-manifest.d.ts +2 -11
- package/build/src/updaters/release-please-manifest.js +11 -14
- package/build/src/updaters/ruby/version-rb.d.ts +12 -0
- package/build/src/updaters/{version-rb.js → ruby/version-rb.js} +10 -8
- package/build/src/updaters/rust/cargo-lock.d.ts +7 -11
- package/build/src/updaters/rust/cargo-lock.js +14 -16
- package/build/src/updaters/rust/cargo-toml.d.ts +7 -11
- package/build/src/updaters/rust/cargo-toml.js +19 -21
- package/build/src/updaters/terraform/module-version.d.ts +10 -11
- package/build/src/updaters/terraform/module-version.js +11 -9
- package/build/src/updaters/terraform/readme.d.ts +10 -11
- package/build/src/updaters/terraform/readme.js +11 -10
- package/build/src/updaters/terraform/readme.js.map +1 -1
- package/build/src/util/branch-name.d.ts +5 -4
- package/build/src/util/branch-name.js +13 -10
- package/build/src/{commit-split.d.ts → util/commit-split.d.ts} +2 -4
- package/build/src/{commit-split.js → util/commit-split.js} +4 -2
- package/build/src/util/indent-commit.d.ts +1 -1
- package/build/src/util/logger.d.ts +5 -2
- package/build/src/util/logger.js +9 -4
- package/build/src/util/pull-request-body.d.ts +20 -0
- package/build/src/util/pull-request-body.js +129 -0
- package/build/src/util/pull-request-title.d.ts +8 -6
- package/build/src/util/pull-request-title.js +20 -6
- package/build/src/util/tag-name.d.ts +9 -0
- package/build/src/util/tag-name.js +41 -0
- package/build/src/{updaters → util}/toml-edit.d.ts +0 -0
- package/build/src/{updaters → util}/toml-edit.js +0 -0
- package/build/src/version.d.ts +11 -0
- package/build/src/version.js +45 -0
- package/build/src/versioning-strategies/always-bump-patch.d.ts +7 -0
- package/build/src/{updaters/package-lock-json.js → versioning-strategies/always-bump-patch.js} +8 -11
- package/build/src/versioning-strategies/default.d.ts +15 -0
- package/build/src/versioning-strategies/default.js +67 -0
- package/build/src/versioning-strategies/dependency-manifest.d.ts +7 -0
- package/build/src/versioning-strategies/dependency-manifest.js +90 -0
- package/build/src/versioning-strategies/java-add-snapshot.d.ts +9 -0
- package/build/src/versioning-strategies/java-add-snapshot.js +53 -0
- package/build/src/versioning-strategies/java-snapshot.d.ts +9 -0
- package/build/src/versioning-strategies/java-snapshot.js +67 -0
- package/build/src/versioning-strategies/service-pack.d.ts +7 -0
- package/build/src/versioning-strategies/service-pack.js +40 -0
- package/build/src/versioning-strategy.d.ts +28 -0
- package/build/src/versioning-strategy.js +55 -0
- package/package.json +9 -8
- package/build/src/constants.d.ts +0 -6
- package/build/src/constants.js +0 -23
- package/build/src/conventional-commits.d.ts +0 -53
- package/build/src/conventional-commits.js +0 -167
- package/build/src/github-release.d.ts +0 -34
- package/build/src/github-release.js +0 -92
- package/build/src/graphql-to-commits.d.ts +0 -60
- package/build/src/graphql-to-commits.js +0 -112
- package/build/src/index.d.ts +0 -94
- package/build/src/index.js +0 -32
- package/build/src/plugins/index.d.ts +0 -5
- package/build/src/plugins/plugin.d.ts +0 -21
- package/build/src/release-pr.d.ts +0 -101
- package/build/src/release-pr.js +0 -461
- package/build/src/releasers/elixir.d.ts +0 -5
- package/build/src/releasers/go-yoshi.d.ts +0 -10
- package/build/src/releasers/go-yoshi.js +0 -162
- package/build/src/releasers/go.d.ts +0 -6
- package/build/src/releasers/helm.d.ts +0 -9
- package/build/src/releasers/helm.js +0 -66
- package/build/src/releasers/index.d.ts +0 -7
- package/build/src/releasers/index.js +0 -72
- package/build/src/releasers/java/bump_type.d.ts +0 -4
- package/build/src/releasers/java/bump_type.js +0 -38
- package/build/src/releasers/java/stability.d.ts +0 -5
- package/build/src/releasers/java/stability.js +0 -37
- package/build/src/releasers/java/version.d.ts +0 -13
- package/build/src/releasers/java/version.js +0 -112
- package/build/src/releasers/java-bom.d.ts +0 -16
- package/build/src/releasers/java-bom.js +0 -83
- package/build/src/releasers/java-lts.d.ts +0 -9
- package/build/src/releasers/java-lts.js +0 -47
- package/build/src/releasers/java-yoshi.d.ts +0 -28
- package/build/src/releasers/java-yoshi.js +0 -304
- package/build/src/releasers/krm-blueprint.d.ts +0 -6
- package/build/src/releasers/node.d.ts +0 -10
- package/build/src/releasers/node.js +0 -84
- package/build/src/releasers/ocaml.d.ts +0 -5
- package/build/src/releasers/php-yoshi.d.ts +0 -5
- package/build/src/releasers/php-yoshi.js +0 -191
- package/build/src/releasers/php.d.ts +0 -7
- package/build/src/releasers/python.d.ts +0 -11
- package/build/src/releasers/python.js +0 -127
- package/build/src/releasers/ruby-yoshi.d.ts +0 -5
- package/build/src/releasers/ruby-yoshi.js +0 -142
- package/build/src/releasers/ruby.d.ts +0 -11
- package/build/src/releasers/rust.d.ts +0 -30
- package/build/src/releasers/rust.js +0 -163
- package/build/src/releasers/simple.d.ts +0 -5
- package/build/src/releasers/terraform-module.d.ts +0 -6
- package/build/src/updaters/elixir-mix-exs.d.ts +0 -13
- package/build/src/updaters/java/google-utils.d.ts +0 -13
- package/build/src/updaters/java/java_update.d.ts +0 -13
- package/build/src/updaters/java/pom-xml.d.ts +0 -3
- package/build/src/updaters/java/readme.d.ts +0 -3
- package/build/src/updaters/java/readme.js.map +0 -1
- package/build/src/updaters/package-json.d.ts +0 -16
- package/build/src/updaters/package-lock-json.d.ts +0 -7
- package/build/src/updaters/php-client-version.d.ts +0 -13
- package/build/src/updaters/php-manifest.d.ts +0 -13
- package/build/src/updaters/root-composer-update-package.d.ts +0 -13
- package/build/src/updaters/root-composer-update-package.js +0 -45
- package/build/src/updaters/root-composer-update-packages.d.ts +0 -13
- package/build/src/updaters/samples-package-json.d.ts +0 -13
- package/build/src/updaters/update.d.ts +0 -20
- package/build/src/updaters/version-rb.d.ts +0 -13
- package/build/src/updaters/version-txt.d.ts +0 -12
- package/build/src/updaters/version.d.ts +0 -13
- package/build/src/updaters/version.js +0 -31
- package/build/src/util/checkpoint.d.ts +0 -6
- package/build/src/util/checkpoint.js +0 -33
- package/build/src/util/release-notes.d.ts +0 -7
- package/build/src/util/release-notes.js +0 -34
- package/build/src/util/to-conventional-changelog-format.d.ts +0 -2
package/build/src/release-pr.js
DELETED
|
@@ -1,461 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright 2019 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.ReleasePR = void 0;
|
|
17
|
-
const constants_1 = require("./constants");
|
|
18
|
-
const semver = require("semver");
|
|
19
|
-
const conventional_commits_1 = require("./conventional-commits");
|
|
20
|
-
const branch_name_1 = require("./util/branch-name");
|
|
21
|
-
const release_notes_1 = require("./util/release-notes");
|
|
22
|
-
const pull_request_title_1 = require("./util/pull-request-title");
|
|
23
|
-
const changelog_1 = require("./updaters/changelog");
|
|
24
|
-
const logger_1 = require("./util/logger");
|
|
25
|
-
const signoff_commit_message_1 = require("./util/signoff-commit-message");
|
|
26
|
-
class ReleasePR {
|
|
27
|
-
constructor(options) {
|
|
28
|
-
var _a, _b, _c, _d;
|
|
29
|
-
this.changelogPath = 'CHANGELOG.md';
|
|
30
|
-
this.enableSimplePrereleaseParsing = false;
|
|
31
|
-
this.bumpMinorPreMajor = options.bumpMinorPreMajor || false;
|
|
32
|
-
this.bumpPatchForMinorPreMajor = options.bumpPatchForMinorPreMajor || false;
|
|
33
|
-
this.labels = (_a = options.labels) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_LABELS;
|
|
34
|
-
// undefined represents the root path of the library, if the special
|
|
35
|
-
// '.' path is provided, simply ignore it:
|
|
36
|
-
this.path = options.path !== '.' ? options.path : undefined;
|
|
37
|
-
this.packageName = options.packageName || '';
|
|
38
|
-
this.monorepoTags = options.monorepoTags || false;
|
|
39
|
-
this.releaseAs = options.releaseAs;
|
|
40
|
-
this.snapshot = options.snapshot;
|
|
41
|
-
// drop a `v` prefix if provided:
|
|
42
|
-
this.lastPackageVersion = options.lastPackageVersion
|
|
43
|
-
? options.lastPackageVersion.replace(/^v/, '')
|
|
44
|
-
: undefined;
|
|
45
|
-
this.gh = options.github;
|
|
46
|
-
this.changelogSections = options.changelogSections;
|
|
47
|
-
this.changelogPath = (_b = options.changelogPath) !== null && _b !== void 0 ? _b : this.changelogPath;
|
|
48
|
-
this.pullRequestTitlePattern = options.pullRequestTitlePattern;
|
|
49
|
-
this.signoff = options.signoff;
|
|
50
|
-
this.extraFiles = (_c = options.extraFiles) !== null && _c !== void 0 ? _c : [];
|
|
51
|
-
this.forManifestReleaser = (_d = options.skipDependencyUpdates) !== null && _d !== void 0 ? _d : false;
|
|
52
|
-
this.latestTagOverride = options.latestTag;
|
|
53
|
-
}
|
|
54
|
-
// A releaser can override this method to automatically detect the
|
|
55
|
-
// packageName from source code (e.g. package.json "name")
|
|
56
|
-
async getPackageName() {
|
|
57
|
-
return {
|
|
58
|
-
name: this.packageName,
|
|
59
|
-
getComponent: () => this.packageName,
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
async getOpenPROptions(commits, latestTag) {
|
|
63
|
-
await this.validateConfiguration();
|
|
64
|
-
return this._getOpenPROptions(commits, latestTag);
|
|
65
|
-
}
|
|
66
|
-
async _getOpenPROptions(commits, latestTag) {
|
|
67
|
-
const cc = new conventional_commits_1.ConventionalCommits({
|
|
68
|
-
commits,
|
|
69
|
-
owner: this.gh.owner,
|
|
70
|
-
repository: this.gh.repo,
|
|
71
|
-
bumpMinorPreMajor: this.bumpMinorPreMajor,
|
|
72
|
-
bumpPatchForMinorPreMajor: this.bumpPatchForMinorPreMajor,
|
|
73
|
-
changelogSections: this.changelogSections,
|
|
74
|
-
});
|
|
75
|
-
const candidate = await this.coerceReleaseCandidate(cc, latestTag);
|
|
76
|
-
const changelogEntry = await cc.generateChangelogEntry({
|
|
77
|
-
version: candidate.version,
|
|
78
|
-
currentTag: await this.normalizeTagName(candidate.version),
|
|
79
|
-
previousTag: candidate.previousTag
|
|
80
|
-
? await this.normalizeTagName(candidate.previousTag)
|
|
81
|
-
: undefined,
|
|
82
|
-
});
|
|
83
|
-
// don't create a release candidate until user facing changes
|
|
84
|
-
// (fix, feat, BREAKING CHANGE) have been made; a CHANGELOG that's
|
|
85
|
-
// one line is a good indicator that there were no interesting commits.
|
|
86
|
-
if (this.changelogEmpty(changelogEntry)) {
|
|
87
|
-
logger_1.logger.warn(`no user facing commits found since ${latestTag ? latestTag.sha : 'beginning of time'}`);
|
|
88
|
-
return undefined;
|
|
89
|
-
}
|
|
90
|
-
const packageName = await this.getPackageName();
|
|
91
|
-
const updates = await this.buildUpdates(changelogEntry, candidate, packageName);
|
|
92
|
-
return {
|
|
93
|
-
sha: commits[0].sha,
|
|
94
|
-
changelogEntry: `${changelogEntry}\n---\n`,
|
|
95
|
-
updates,
|
|
96
|
-
version: candidate.version,
|
|
97
|
-
includePackageName: this.monorepoTags,
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
async run() {
|
|
101
|
-
await this.validateConfiguration();
|
|
102
|
-
if (this.snapshot && !this.supportsSnapshots()) {
|
|
103
|
-
logger_1.logger.warn('snapshot releases not supported for this releaser');
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
// TODO: consider switching to this.findMergedRelease()
|
|
107
|
-
const mergedPR = await this.gh.findMergedReleasePR(this.labels, undefined, true, 100);
|
|
108
|
-
if (mergedPR) {
|
|
109
|
-
// a PR already exists in the autorelease: pending state.
|
|
110
|
-
logger_1.logger.warn(`pull #${mergedPR.number} ${mergedPR.sha} has not yet been released`);
|
|
111
|
-
return undefined;
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
return this._run();
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
async _run() {
|
|
118
|
-
const packageName = await this.getPackageName();
|
|
119
|
-
const latestTag = await this.latestTag(this.monorepoTags ? `${packageName.getComponent()}-` : undefined, this.enableSimplePrereleaseParsing);
|
|
120
|
-
const commits = await this.commits({
|
|
121
|
-
sha: latestTag ? latestTag.sha : undefined,
|
|
122
|
-
path: this.path,
|
|
123
|
-
});
|
|
124
|
-
const openPROptions = await this.getOpenPROptions(commits, latestTag);
|
|
125
|
-
return openPROptions ? await this.openPR(openPROptions) : undefined;
|
|
126
|
-
}
|
|
127
|
-
async buildUpdates(changelogEntry, candidate, packageName) {
|
|
128
|
-
const updates = [];
|
|
129
|
-
updates.push(new changelog_1.Changelog({
|
|
130
|
-
path: this.changelogPath,
|
|
131
|
-
changelogEntry,
|
|
132
|
-
version: candidate.version,
|
|
133
|
-
packageName: packageName.name,
|
|
134
|
-
}));
|
|
135
|
-
return updates;
|
|
136
|
-
}
|
|
137
|
-
supportsSnapshots() {
|
|
138
|
-
return false;
|
|
139
|
-
}
|
|
140
|
-
async closeStaleReleasePRs(currentPRNumber, includePackageName = false) {
|
|
141
|
-
const prs = await this.gh.findOpenReleasePRs(this.labels);
|
|
142
|
-
const packageName = await this.getPackageName();
|
|
143
|
-
for (let i = 0, pr; i < prs.length; i++) {
|
|
144
|
-
pr = prs[i];
|
|
145
|
-
// don't close the most up-to-date release PR.
|
|
146
|
-
if (pr.number !== currentPRNumber) {
|
|
147
|
-
// on mono repos that maintain multiple open release PRs, we use the
|
|
148
|
-
// pull request title to differentiate between PRs:
|
|
149
|
-
if (includePackageName && !pr.title.includes(` ${packageName.name} `)) {
|
|
150
|
-
continue;
|
|
151
|
-
}
|
|
152
|
-
logger_1.logger.info(`closing pull #${pr.number}`);
|
|
153
|
-
await this.gh.closePR(pr.number);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
defaultInitialVersion() {
|
|
158
|
-
return this.bumpMinorPreMajor ? '0.1.0' : '1.0.0';
|
|
159
|
-
}
|
|
160
|
-
tagSeparator() {
|
|
161
|
-
return '-';
|
|
162
|
-
}
|
|
163
|
-
async normalizeTagName(versionOrTagName) {
|
|
164
|
-
if (!this.monorepoTags) {
|
|
165
|
-
return versionOrTagName.replace(/^v?/, 'v');
|
|
166
|
-
}
|
|
167
|
-
const pkgName = await this.getPackageName();
|
|
168
|
-
const tagPrefix = pkgName.getComponent() + this.tagSeparator() + 'v';
|
|
169
|
-
const re = new RegExp(`^(${tagPrefix}|)`);
|
|
170
|
-
return versionOrTagName.replace(re, tagPrefix);
|
|
171
|
-
}
|
|
172
|
-
async coerceReleaseCandidate(cc, latestTag, enableSimplePrereleaseParsing = false) {
|
|
173
|
-
var _a, _b;
|
|
174
|
-
const releaseAsRe = /release-as:\s*v?([0-9]+\.[0-9]+\.[0-9a-z]+(-[0-9a-z.]+)?)\s*/i;
|
|
175
|
-
const previousTag = latestTag ? latestTag.name : undefined;
|
|
176
|
-
let version = latestTag ? latestTag.version : this.defaultInitialVersion();
|
|
177
|
-
// If a commit contains the footer release-as: 1.x.x, we use this version
|
|
178
|
-
// from the commit footer rather than the version returned by suggestBump().
|
|
179
|
-
let forcedVersion;
|
|
180
|
-
const releaseAsCommit = cc.parsedCommits.find(element => {
|
|
181
|
-
var _a, _b;
|
|
182
|
-
const bodyMatch = (_a = element.body) === null || _a === void 0 ? void 0 : _a.match(releaseAsRe);
|
|
183
|
-
if (bodyMatch) {
|
|
184
|
-
forcedVersion = bodyMatch[1];
|
|
185
|
-
return true;
|
|
186
|
-
}
|
|
187
|
-
const footerMatch = (_b = element.footer) === null || _b === void 0 ? void 0 : _b.match(releaseAsRe);
|
|
188
|
-
if (footerMatch) {
|
|
189
|
-
forcedVersion = footerMatch[1];
|
|
190
|
-
return true;
|
|
191
|
-
}
|
|
192
|
-
return false;
|
|
193
|
-
});
|
|
194
|
-
if (releaseAsCommit) {
|
|
195
|
-
version = forcedVersion;
|
|
196
|
-
}
|
|
197
|
-
else if (enableSimplePrereleaseParsing) {
|
|
198
|
-
// Handle pre-release format v1.0.0-alpha1, alpha2, etc.
|
|
199
|
-
const [prefix, suffix] = version.split('-');
|
|
200
|
-
const match = suffix === null || suffix === void 0 ? void 0 : suffix.match(/(?<type>[^0-9]+)(?<number>[0-9]+)/);
|
|
201
|
-
const number = Number(((_a = match === null || match === void 0 ? void 0 : match.groups) === null || _a === void 0 ? void 0 : _a.number) || 0) + 1;
|
|
202
|
-
version = `${prefix}-${((_b = match === null || match === void 0 ? void 0 : match.groups) === null || _b === void 0 ? void 0 : _b.type) || 'alpha'}${number}`;
|
|
203
|
-
}
|
|
204
|
-
else if (latestTag && !this.releaseAs) {
|
|
205
|
-
const bump = await cc.suggestBump(version);
|
|
206
|
-
const candidate = semver.inc(version, bump.releaseType);
|
|
207
|
-
if (!candidate)
|
|
208
|
-
throw Error(`failed to increment ${version}`);
|
|
209
|
-
version = candidate;
|
|
210
|
-
}
|
|
211
|
-
else if (this.releaseAs) {
|
|
212
|
-
version = this.releaseAs;
|
|
213
|
-
}
|
|
214
|
-
return { version, previousTag };
|
|
215
|
-
}
|
|
216
|
-
async commits(opts) {
|
|
217
|
-
const sha = opts.sha;
|
|
218
|
-
const perPage = opts.perPage || 100;
|
|
219
|
-
const labels = opts.labels || false;
|
|
220
|
-
const path = opts.path || undefined;
|
|
221
|
-
const commits = await this.gh.commitsSinceSha(sha, perPage, labels, path);
|
|
222
|
-
if (commits.length) {
|
|
223
|
-
logger_1.logger.info(`found ${commits.length} commits since ${sha ? sha : 'beginning of time'}`);
|
|
224
|
-
}
|
|
225
|
-
else {
|
|
226
|
-
logger_1.logger.warn(`no commits found since ${sha}`);
|
|
227
|
-
}
|
|
228
|
-
return commits;
|
|
229
|
-
}
|
|
230
|
-
// Override this method to modify the pull request title
|
|
231
|
-
async buildPullRequestTitle(version, includePackageName) {
|
|
232
|
-
const packageName = await this.getPackageName();
|
|
233
|
-
const pullRequestTitle = includePackageName
|
|
234
|
-
? pull_request_title_1.PullRequestTitle.ofComponentVersion(packageName.name, version, this.pullRequestTitlePattern)
|
|
235
|
-
: pull_request_title_1.PullRequestTitle.ofVersion(version, this.pullRequestTitlePattern);
|
|
236
|
-
return pullRequestTitle.toString();
|
|
237
|
-
}
|
|
238
|
-
// Override this method to detect the release version from code (if it cannot be
|
|
239
|
-
// inferred from the release PR head branch)
|
|
240
|
-
detectReleaseVersionFromTitle(title) {
|
|
241
|
-
const pullRequestTitle = pull_request_title_1.PullRequestTitle.parse(title, this.pullRequestTitlePattern);
|
|
242
|
-
if (pullRequestTitle) {
|
|
243
|
-
return pullRequestTitle.getVersion();
|
|
244
|
-
}
|
|
245
|
-
return undefined;
|
|
246
|
-
}
|
|
247
|
-
// Override this method to modify the pull request head branch name
|
|
248
|
-
// If you modify this, you must ensure that the releaser can parse the tag version
|
|
249
|
-
// from the pull request.
|
|
250
|
-
async buildBranchName(version, includePackageName) {
|
|
251
|
-
const packageName = await this.getPackageName();
|
|
252
|
-
if (includePackageName && packageName) {
|
|
253
|
-
return branch_name_1.BranchName.ofComponentVersion((await this.getPackageName()).getComponent(), version);
|
|
254
|
-
}
|
|
255
|
-
return branch_name_1.BranchName.ofVersion(version);
|
|
256
|
-
}
|
|
257
|
-
// Override this method to modify the pull request body
|
|
258
|
-
async buildPullRequestBody(_version, changelogEntry) {
|
|
259
|
-
return `:robot: I have created a release \\*beep\\* \\*boop\\*\n---\n${changelogEntry}\n\nThis PR was generated with [Release Please](https://github.com/googleapis/${constants_1.RELEASE_PLEASE}). See [documentation](https://github.com/googleapis/${constants_1.RELEASE_PLEASE}#${constants_1.RELEASE_PLEASE}).`;
|
|
260
|
-
}
|
|
261
|
-
async openPR(options) {
|
|
262
|
-
const changelogEntry = options.changelogEntry;
|
|
263
|
-
const updates = options.updates;
|
|
264
|
-
const version = options.version;
|
|
265
|
-
const includePackageName = options.includePackageName;
|
|
266
|
-
const title = await this.buildPullRequestTitle(version, includePackageName);
|
|
267
|
-
const body = await this.buildPullRequestBody(version, changelogEntry);
|
|
268
|
-
// Sign-off message if signoff option is enabled
|
|
269
|
-
const message = this.signoff
|
|
270
|
-
? signoff_commit_message_1.signoffCommitMessage(title, this.signoff)
|
|
271
|
-
: title;
|
|
272
|
-
const branchName = await this.buildBranchName(version, includePackageName);
|
|
273
|
-
const pr = await this.gh.openPR({
|
|
274
|
-
branch: branchName.toString(),
|
|
275
|
-
updates,
|
|
276
|
-
title,
|
|
277
|
-
message,
|
|
278
|
-
body,
|
|
279
|
-
labels: this.labels,
|
|
280
|
-
});
|
|
281
|
-
// a return of undefined indicates that PR was not updated.
|
|
282
|
-
if (pr) {
|
|
283
|
-
await this.gh.addLabels(this.labels, pr);
|
|
284
|
-
logger_1.logger.info(`find stale PRs with label "${this.labels.join(',')}"`);
|
|
285
|
-
await this.closeStaleReleasePRs(pr, includePackageName);
|
|
286
|
-
}
|
|
287
|
-
return pr;
|
|
288
|
-
}
|
|
289
|
-
changelogEmpty(changelogEntry) {
|
|
290
|
-
return changelogEntry.split('\n').length === 1;
|
|
291
|
-
}
|
|
292
|
-
addPath(file) {
|
|
293
|
-
file = file.replace(/^[/\\]/, '');
|
|
294
|
-
if (this.path === undefined) {
|
|
295
|
-
return file;
|
|
296
|
-
}
|
|
297
|
-
else {
|
|
298
|
-
const path = this.path.replace(/[/\\]$/, '');
|
|
299
|
-
return `${path}/${file}`;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
// BEGIN release functionality
|
|
303
|
-
// Override this method to detect the release version from code (if it cannot be
|
|
304
|
-
// inferred from the release PR head branch)
|
|
305
|
-
async detectReleaseVersionFromCode() {
|
|
306
|
-
return undefined;
|
|
307
|
-
}
|
|
308
|
-
async detectReleaseVersion(mergedPR, branchName) {
|
|
309
|
-
// try from branch name
|
|
310
|
-
let version = branchName === null || branchName === void 0 ? void 0 : branchName.getVersion();
|
|
311
|
-
if (version) {
|
|
312
|
-
return version;
|
|
313
|
-
}
|
|
314
|
-
// try from PR title
|
|
315
|
-
version = this.detectReleaseVersionFromTitle(mergedPR.title);
|
|
316
|
-
if (version) {
|
|
317
|
-
return version;
|
|
318
|
-
}
|
|
319
|
-
// detect from code
|
|
320
|
-
return this.detectReleaseVersionFromCode();
|
|
321
|
-
}
|
|
322
|
-
formatReleaseTagName(version, packageName) {
|
|
323
|
-
if (this.monorepoTags) {
|
|
324
|
-
return `${packageName.getComponent()}${this.tagSeparator()}v${version}`;
|
|
325
|
-
}
|
|
326
|
-
return `v${version}`;
|
|
327
|
-
}
|
|
328
|
-
async validateConfiguration() {
|
|
329
|
-
if (this.monorepoTags) {
|
|
330
|
-
const packageName = await this.getPackageName();
|
|
331
|
-
if (packageName.getComponent() === '') {
|
|
332
|
-
throw new Error('package-name required for monorepo releases');
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
// Logic for determining what to include in a GitHub release.
|
|
337
|
-
async buildRelease() {
|
|
338
|
-
await this.validateConfiguration();
|
|
339
|
-
const mergedPR = await this.findMergedRelease();
|
|
340
|
-
if (!mergedPR) {
|
|
341
|
-
logger_1.logger.warn('No merged release PR found');
|
|
342
|
-
return undefined;
|
|
343
|
-
}
|
|
344
|
-
const branchName = branch_name_1.BranchName.parse(mergedPR.headRefName);
|
|
345
|
-
const version = await this.detectReleaseVersion(mergedPR, branchName);
|
|
346
|
-
if (!version) {
|
|
347
|
-
logger_1.logger.warn('Unable to detect release version');
|
|
348
|
-
return undefined;
|
|
349
|
-
}
|
|
350
|
-
return this.buildReleaseForVersion(version, mergedPR);
|
|
351
|
-
}
|
|
352
|
-
async buildReleaseForVersion(version, mergedPR) {
|
|
353
|
-
const packageName = await this.getPackageName();
|
|
354
|
-
const tag = this.formatReleaseTagName(version, packageName);
|
|
355
|
-
const changelogContents = (await this.gh.getFileContents(this.addPath(this.changelogPath))).parsedContent;
|
|
356
|
-
const notes = release_notes_1.extractReleaseNotes(changelogContents, version);
|
|
357
|
-
return {
|
|
358
|
-
sha: mergedPR.sha,
|
|
359
|
-
tag,
|
|
360
|
-
notes,
|
|
361
|
-
name: packageName.name,
|
|
362
|
-
version,
|
|
363
|
-
pullNumber: mergedPR.number,
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
async findMergedRelease() {
|
|
367
|
-
const targetBranch = await this.gh.getDefaultBranch();
|
|
368
|
-
const component = (await this.getPackageName()).getComponent();
|
|
369
|
-
const filter = this.monorepoTags
|
|
370
|
-
? (pullRequest) => {
|
|
371
|
-
var _a;
|
|
372
|
-
if (this.labels.length > 0 &&
|
|
373
|
-
!this.labels.every(label => pullRequest.labels.includes(label))) {
|
|
374
|
-
return false;
|
|
375
|
-
}
|
|
376
|
-
// in a monorepo, filter PR head branch by component
|
|
377
|
-
return (((_a = branch_name_1.BranchName.parse(pullRequest.headRefName)) === null || _a === void 0 ? void 0 : _a.getComponent()) ===
|
|
378
|
-
component);
|
|
379
|
-
}
|
|
380
|
-
: (pullRequest) => {
|
|
381
|
-
if (this.labels.length > 0 &&
|
|
382
|
-
!this.labels.every(label => pullRequest.labels.includes(label))) {
|
|
383
|
-
return false;
|
|
384
|
-
}
|
|
385
|
-
// accept any release PR head branch pattern
|
|
386
|
-
return !!branch_name_1.BranchName.parse(pullRequest.headRefName);
|
|
387
|
-
};
|
|
388
|
-
return await this.gh.findMergedPullRequest(targetBranch, filter);
|
|
389
|
-
}
|
|
390
|
-
/**
|
|
391
|
-
* Normalize version parsing when searching for a latest release.
|
|
392
|
-
*
|
|
393
|
-
* @param version The raw version string
|
|
394
|
-
* @param preRelease Whether to allow pre-release versions or not
|
|
395
|
-
* @returns {string|null} The normalized version string or null if
|
|
396
|
-
* we want to disallow this version.
|
|
397
|
-
*/
|
|
398
|
-
normalizeVersion(version, preRelease = false) {
|
|
399
|
-
// Consider any version with a '-' as a pre-release version
|
|
400
|
-
if (!preRelease && version.indexOf('-') >= 0) {
|
|
401
|
-
return null;
|
|
402
|
-
}
|
|
403
|
-
// Allow the '-' separator to be omitted.
|
|
404
|
-
if (preRelease && !version.includes('-') && version.match(/[a-zB-Z]/)) {
|
|
405
|
-
version = version.replace(/([a-zA-Z])/, '-$1');
|
|
406
|
-
}
|
|
407
|
-
return semver.valid(version);
|
|
408
|
-
}
|
|
409
|
-
/**
|
|
410
|
-
* Find the most recent matching release tag on the branch we're
|
|
411
|
-
* configured for.
|
|
412
|
-
*
|
|
413
|
-
* @param {string} prefix - Limit the release to a specific component.
|
|
414
|
-
* @param {boolean} preRelease - Whether or not to return pre-release
|
|
415
|
-
* versions. Defaults to false.
|
|
416
|
-
*/
|
|
417
|
-
async latestTag(prefix, preRelease = false) {
|
|
418
|
-
if (this.latestTagOverride) {
|
|
419
|
-
return this.latestTagOverride;
|
|
420
|
-
}
|
|
421
|
-
const branchPrefix = (prefix === null || prefix === void 0 ? void 0 : prefix.endsWith('-')) ? prefix.replace(/-$/, '')
|
|
422
|
-
: prefix;
|
|
423
|
-
// only look at the last 250 or so commits to find the latest tag - we
|
|
424
|
-
// don't want to scan the entire repository history if this repo has never
|
|
425
|
-
// been released
|
|
426
|
-
const generator = this.gh.mergeCommitIterator(250);
|
|
427
|
-
for await (const commitWithPullRequest of generator) {
|
|
428
|
-
const mergedPullRequest = commitWithPullRequest.pullRequest;
|
|
429
|
-
if (!mergedPullRequest) {
|
|
430
|
-
continue;
|
|
431
|
-
}
|
|
432
|
-
const branchName = branch_name_1.BranchName.parse(mergedPullRequest.headRefName);
|
|
433
|
-
if (!branchName) {
|
|
434
|
-
continue;
|
|
435
|
-
}
|
|
436
|
-
// If branchPrefix is specified, ensure it is found in the branch name.
|
|
437
|
-
// If branchPrefix is not specified, component should also be undefined.
|
|
438
|
-
if (branchName.getComponent() !== branchPrefix) {
|
|
439
|
-
continue;
|
|
440
|
-
}
|
|
441
|
-
const version = await this.detectReleaseVersion(mergedPullRequest, branchName);
|
|
442
|
-
if (!version) {
|
|
443
|
-
continue;
|
|
444
|
-
}
|
|
445
|
-
// Make sure we did get a valid semver.
|
|
446
|
-
const normalizedVersion = this.normalizeVersion(version, preRelease);
|
|
447
|
-
if (!normalizedVersion) {
|
|
448
|
-
continue;
|
|
449
|
-
}
|
|
450
|
-
return {
|
|
451
|
-
name: await this.normalizeTagName(normalizedVersion),
|
|
452
|
-
sha: mergedPullRequest.sha,
|
|
453
|
-
version: normalizedVersion,
|
|
454
|
-
};
|
|
455
|
-
}
|
|
456
|
-
// did not find a recent merged release PR, fallback to tags on the repo
|
|
457
|
-
return await this.gh.latestTagFallback(prefix, preRelease);
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
exports.ReleasePR = ReleasePR;
|
|
461
|
-
//# sourceMappingURL=release-pr.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { ReleasePR, ReleaseCandidate, PackageName } from '../release-pr';
|
|
2
|
-
import { Update } from '../updaters/update';
|
|
3
|
-
export declare class Elixir extends ReleasePR {
|
|
4
|
-
protected buildUpdates(changelogEntry: string, candidate: ReleaseCandidate, packageName: PackageName): Promise<Update[]>;
|
|
5
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ReleasePR } from '../release-pr';
|
|
2
|
-
export declare class GoYoshi extends ReleasePR {
|
|
3
|
-
changelogPath: string;
|
|
4
|
-
protected _run(): Promise<number | undefined>;
|
|
5
|
-
private isGapicRepo;
|
|
6
|
-
private isMultiClientRepo;
|
|
7
|
-
defaultInitialVersion(): string;
|
|
8
|
-
tagSeparator(): string;
|
|
9
|
-
private filterSubModuleCommits;
|
|
10
|
-
}
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright 2020 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.GoYoshi = void 0;
|
|
17
|
-
const release_pr_1 = require("../release-pr");
|
|
18
|
-
const conventional_commits_1 = require("../conventional-commits");
|
|
19
|
-
// Generic
|
|
20
|
-
const changelog_1 = require("../updaters/changelog");
|
|
21
|
-
const logger_1 = require("../util/logger");
|
|
22
|
-
// Commits containing a scope prefixed with an item in this array will be
|
|
23
|
-
// ignored when generating a release PR for the parent module.
|
|
24
|
-
const SUB_MODULES = [
|
|
25
|
-
'bigtable',
|
|
26
|
-
'bigquery',
|
|
27
|
-
'datastore',
|
|
28
|
-
'firestore',
|
|
29
|
-
'logging',
|
|
30
|
-
'pubsub',
|
|
31
|
-
'pubsublite',
|
|
32
|
-
'spanner',
|
|
33
|
-
'storage',
|
|
34
|
-
];
|
|
35
|
-
const REGEN_PR_REGEX = /.*auto-regenerate.*/;
|
|
36
|
-
class GoYoshi extends release_pr_1.ReleasePR {
|
|
37
|
-
constructor() {
|
|
38
|
-
super(...arguments);
|
|
39
|
-
this.changelogPath = 'CHANGES.md';
|
|
40
|
-
}
|
|
41
|
-
async _run() {
|
|
42
|
-
const packageName = await this.getPackageName();
|
|
43
|
-
const latestTag = await this.latestTag(this.monorepoTags ? `${packageName.getComponent()}-` : undefined, false);
|
|
44
|
-
let regenPR;
|
|
45
|
-
let sha = null;
|
|
46
|
-
const commits = (await this.commits({
|
|
47
|
-
sha: latestTag === null || latestTag === void 0 ? void 0 : latestTag.sha,
|
|
48
|
-
path: this.path,
|
|
49
|
-
})).filter(commit => {
|
|
50
|
-
var _a, _b;
|
|
51
|
-
// Store the very first SHA returned, this represents the HEAD of the
|
|
52
|
-
// release being created:
|
|
53
|
-
if (!sha) {
|
|
54
|
-
sha = commit.sha;
|
|
55
|
-
}
|
|
56
|
-
if (this.gh.repo === 'google-api-go-client' &&
|
|
57
|
-
REGEN_PR_REGEX.test(commit.message)) {
|
|
58
|
-
// Only have a single entry of the nightly regen listed in the changelog.
|
|
59
|
-
// If there are more than one of these commits, append associated PR.
|
|
60
|
-
const issueRe = /(?<prefix>.*)\((?<pr>.*)\)(\n|$)/;
|
|
61
|
-
if (regenPR) {
|
|
62
|
-
const match = commit.message.match(issueRe);
|
|
63
|
-
if ((_a = match === null || match === void 0 ? void 0 : match.groups) === null || _a === void 0 ? void 0 : _a.pr) {
|
|
64
|
-
regenPR.message += `\nRefs ${match.groups.pr}`;
|
|
65
|
-
}
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
// Throw away the sha for nightly regens, will just append PR numbers.
|
|
70
|
-
commit.sha = null;
|
|
71
|
-
regenPR = commit;
|
|
72
|
-
const match = commit.message.match(issueRe);
|
|
73
|
-
if ((_b = match === null || match === void 0 ? void 0 : match.groups) === null || _b === void 0 ? void 0 : _b.pr) {
|
|
74
|
-
regenPR.message = `${match.groups.prefix}\n\nRefs ${match.groups.pr}`;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return true;
|
|
79
|
-
});
|
|
80
|
-
const cc = new conventional_commits_1.ConventionalCommits({
|
|
81
|
-
commits: commits,
|
|
82
|
-
owner: this.gh.owner,
|
|
83
|
-
repository: this.gh.repo,
|
|
84
|
-
bumpMinorPreMajor: this.bumpMinorPreMajor,
|
|
85
|
-
commitFilter: this.filterSubModuleCommits(this.gh.repo, packageName.name),
|
|
86
|
-
});
|
|
87
|
-
const candidate = await this.coerceReleaseCandidate(cc, latestTag);
|
|
88
|
-
// "closes" is a little presumptuous, let's just indicate that the
|
|
89
|
-
// PR references these other commits:
|
|
90
|
-
const changelogEntry = (await cc.generateChangelogEntry({
|
|
91
|
-
version: candidate.version,
|
|
92
|
-
currentTag: await this.normalizeTagName(candidate.version),
|
|
93
|
-
previousTag: candidate.previousTag
|
|
94
|
-
? await this.normalizeTagName(candidate.previousTag)
|
|
95
|
-
: undefined,
|
|
96
|
-
})).replace(/, closes /g, ', refs ');
|
|
97
|
-
// don't create a release candidate until user facing changes
|
|
98
|
-
// (fix, feat, BREAKING CHANGE) have been made; a CHANGELOG that's
|
|
99
|
-
// one line is a good indicator that there were no interesting commits.
|
|
100
|
-
if (this.changelogEmpty(changelogEntry)) {
|
|
101
|
-
logger_1.logger.warn(`no user facing commits found since ${latestTag ? latestTag.sha : 'beginning of time'}`);
|
|
102
|
-
return undefined;
|
|
103
|
-
}
|
|
104
|
-
const updates = [];
|
|
105
|
-
updates.push(new changelog_1.Changelog({
|
|
106
|
-
path: this.addPath(this.changelogPath),
|
|
107
|
-
changelogEntry,
|
|
108
|
-
version: candidate.version,
|
|
109
|
-
packageName: packageName.name,
|
|
110
|
-
}));
|
|
111
|
-
if (!sha) {
|
|
112
|
-
throw Error('no sha found for pull request');
|
|
113
|
-
}
|
|
114
|
-
return await this.openPR({
|
|
115
|
-
sha: sha,
|
|
116
|
-
changelogEntry,
|
|
117
|
-
updates,
|
|
118
|
-
version: candidate.version,
|
|
119
|
-
includePackageName: this.monorepoTags,
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
isGapicRepo(repo) {
|
|
123
|
-
return repo === 'google-cloud-go';
|
|
124
|
-
}
|
|
125
|
-
isMultiClientRepo(repo) {
|
|
126
|
-
return repo === 'google-cloud-go' || repo === 'google-api-go-client';
|
|
127
|
-
}
|
|
128
|
-
defaultInitialVersion() {
|
|
129
|
-
return '0.1.0';
|
|
130
|
-
}
|
|
131
|
-
tagSeparator() {
|
|
132
|
-
return '/';
|
|
133
|
-
}
|
|
134
|
-
filterSubModuleCommits(repo, packageName) {
|
|
135
|
-
return (c) => {
|
|
136
|
-
if (this.isGapicRepo(repo)) {
|
|
137
|
-
// Filter commits that don't have a scope as we don't know where to put
|
|
138
|
-
// them.
|
|
139
|
-
if (!c.scope) {
|
|
140
|
-
return true;
|
|
141
|
-
}
|
|
142
|
-
// Skipping commits related to sub-modules as they are not apart of the
|
|
143
|
-
// parent module.
|
|
144
|
-
if (!this.monorepoTags) {
|
|
145
|
-
for (const subModule of SUB_MODULES) {
|
|
146
|
-
if (c.scope === subModule || c.scope.startsWith(subModule + '/')) {
|
|
147
|
-
return true;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
if (!(c.scope === packageName || c.scope.startsWith(packageName + '/'))) {
|
|
153
|
-
return true;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
return false;
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
exports.GoYoshi = GoYoshi;
|
|
162
|
-
//# sourceMappingURL=go-yoshi.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ReleasePR, ReleaseCandidate, PackageName } from '../release-pr';
|
|
2
|
-
import { Update } from '../updaters/update';
|
|
3
|
-
export declare class Go extends ReleasePR {
|
|
4
|
-
enableSimplePrereleaseParsing: boolean;
|
|
5
|
-
protected buildUpdates(changelogEntry: string, candidate: ReleaseCandidate, packageName: PackageName): Promise<Update[]>;
|
|
6
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ReleasePR, ReleaseCandidate, PackageName } from '../release-pr';
|
|
2
|
-
import { Update } from '../updaters/update';
|
|
3
|
-
export declare class Helm extends ReleasePR {
|
|
4
|
-
private chartYmlContents?;
|
|
5
|
-
private _packageName?;
|
|
6
|
-
protected buildUpdates(changelogEntry: string, candidate: ReleaseCandidate, packageName: PackageName): Promise<Update[]>;
|
|
7
|
-
getPackageName(): Promise<PackageName>;
|
|
8
|
-
private getChartYmlContents;
|
|
9
|
-
}
|