release-please 15.5.1 → 15.7.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
CHANGED
|
@@ -4,6 +4,20 @@
|
|
|
4
4
|
|
|
5
5
|
[1]: https://www.npmjs.com/package/release-please?activeTab=versions
|
|
6
6
|
|
|
7
|
+
## [15.7.0](https://github.com/googleapis/release-please/compare/v15.6.0...v15.7.0) (2023-02-07)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* **changelog.json:** Implement changelog.json for python ([#1841](https://github.com/googleapis/release-please/issues/1841)) ([52594b1](https://github.com/googleapis/release-please/commit/52594b194fdd0ae516776128e6511d5e4cd21518))
|
|
13
|
+
|
|
14
|
+
## [15.6.0](https://github.com/googleapis/release-please/compare/v15.5.1...v15.6.0) (2023-02-01)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **changelog.json:** Add pr suffix to issues array ([#1839](https://github.com/googleapis/release-please/issues/1839)) ([fdd75ef](https://github.com/googleapis/release-please/commit/fdd75efbc276d432f1d9d54f1790f4852a4aa3f7))
|
|
20
|
+
|
|
7
21
|
## [15.5.1](https://github.com/googleapis/release-please/compare/v15.5.0...v15.5.1) (2023-01-30)
|
|
8
22
|
|
|
9
23
|
|
|
@@ -5,5 +5,7 @@ export declare class Python extends BaseStrategy {
|
|
|
5
5
|
constructor(options: BaseStrategyOptions);
|
|
6
6
|
protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
|
|
7
7
|
private getPyProject;
|
|
8
|
+
protected getNameFromSetupPy(): Promise<string | null>;
|
|
9
|
+
protected getSetupPyContents(): Promise<string | null>;
|
|
8
10
|
protected initialReleaseVersion(): Version;
|
|
9
11
|
}
|
|
@@ -16,11 +16,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
16
16
|
exports.Python = void 0;
|
|
17
17
|
const base_1 = require("./base");
|
|
18
18
|
const changelog_1 = require("../updaters/changelog");
|
|
19
|
+
const changelog_json_1 = require("../updaters/changelog-json");
|
|
19
20
|
const version_1 = require("../version");
|
|
20
21
|
const setup_cfg_1 = require("../updaters/python/setup-cfg");
|
|
21
22
|
const setup_py_1 = require("../updaters/python/setup-py");
|
|
22
23
|
const pyproject_toml_1 = require("../updaters/python/pyproject-toml");
|
|
23
24
|
const python_file_with_version_1 = require("../updaters/python/python-file-with-version");
|
|
25
|
+
const errors_1 = require("../errors");
|
|
26
|
+
const filter_commits_1 = require("../util/filter-commits");
|
|
24
27
|
const CHANGELOG_SECTIONS = [
|
|
25
28
|
{ type: 'feat', section: 'Features' },
|
|
26
29
|
{ type: 'fix', section: 'Bug Fixes' },
|
|
@@ -112,6 +115,21 @@ class Python extends base_1.BaseStrategy {
|
|
|
112
115
|
}),
|
|
113
116
|
});
|
|
114
117
|
});
|
|
118
|
+
// If a machine readable changelog.json exists update it:
|
|
119
|
+
const artifactName = projectName !== null && projectName !== void 0 ? projectName : (await this.getNameFromSetupPy());
|
|
120
|
+
if (options.commits && artifactName) {
|
|
121
|
+
const commits = (0, filter_commits_1.filterCommits)(options.commits, this.changelogSections);
|
|
122
|
+
updates.push({
|
|
123
|
+
path: 'changelog.json',
|
|
124
|
+
createIfMissing: false,
|
|
125
|
+
updater: new changelog_json_1.ChangelogJson({
|
|
126
|
+
artifactName,
|
|
127
|
+
version,
|
|
128
|
+
commits,
|
|
129
|
+
language: 'PYTHON',
|
|
130
|
+
}),
|
|
131
|
+
});
|
|
132
|
+
}
|
|
115
133
|
return updates;
|
|
116
134
|
}
|
|
117
135
|
async getPyProject(path) {
|
|
@@ -123,6 +141,31 @@ class Python extends base_1.BaseStrategy {
|
|
|
123
141
|
return null;
|
|
124
142
|
}
|
|
125
143
|
}
|
|
144
|
+
async getNameFromSetupPy() {
|
|
145
|
+
var _a;
|
|
146
|
+
const ARTIFACT_NAME_REGEX = /name *= *['"](?<name>.*)['"](\r|\n|$)/;
|
|
147
|
+
const setupPyContents = await this.getSetupPyContents();
|
|
148
|
+
if (setupPyContents) {
|
|
149
|
+
const match = setupPyContents.match(ARTIFACT_NAME_REGEX);
|
|
150
|
+
if (match && ((_a = match === null || match === void 0 ? void 0 : match.groups) === null || _a === void 0 ? void 0 : _a.name)) {
|
|
151
|
+
return match.groups.name;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
async getSetupPyContents() {
|
|
157
|
+
try {
|
|
158
|
+
return (await this.github.getFileContentsOnBranch(this.addPath('setup.py'), this.targetBranch)).parsedContent;
|
|
159
|
+
}
|
|
160
|
+
catch (e) {
|
|
161
|
+
if (e instanceof errors_1.FileNotFoundError) {
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
throw e;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
126
169
|
initialReleaseVersion() {
|
|
127
170
|
return version_1.Version.parse('0.1.0');
|
|
128
171
|
}
|
|
@@ -19,6 +19,7 @@ const default_1 = require("./default");
|
|
|
19
19
|
const crypto_1 = require("crypto");
|
|
20
20
|
const BREAKING_CHANGE_TITLE = 'BREAKING CHANGE';
|
|
21
21
|
const COMMIT_PREFIX = /^[^:]+: ?/;
|
|
22
|
+
const PR_SUFFIX_REGEX = / ?\(#(?<pr>[0-9]+)\)$/;
|
|
22
23
|
/**
|
|
23
24
|
* Maintians a machine readable CHANGELOG in chnagelog.json.
|
|
24
25
|
* See: https://gist.github.com/bcoe/50ef0a0024bbf107cd5bc0adbdc04758
|
|
@@ -40,17 +41,33 @@ class ChangelogJson extends default_1.DefaultUpdater {
|
|
|
40
41
|
* @returns {string} The updated content
|
|
41
42
|
*/
|
|
42
43
|
updateContent(content, logger = logger_1.logger) {
|
|
44
|
+
var _a;
|
|
43
45
|
const parsed = JSON.parse(content);
|
|
44
46
|
logger.info(`adding release ${this.version} for ${this.artifactName}`);
|
|
45
47
|
const changes = [];
|
|
46
48
|
for (const commit of this.commits) {
|
|
49
|
+
const issues = new Set();
|
|
47
50
|
// The commit.message field contains the type/scope prefix.
|
|
48
|
-
|
|
51
|
+
let message = commit.message.replace(COMMIT_PREFIX, '');
|
|
52
|
+
// When squashing commits, GitHub adds a suffix refrencing
|
|
53
|
+
// the # of the PR, e.g., chore(main): release 15.5.1 (#1838)
|
|
54
|
+
// this logic removes this suffix and prepends it to the
|
|
55
|
+
// issues array.
|
|
56
|
+
const match = message.match(PR_SUFFIX_REGEX);
|
|
57
|
+
if (match && ((_a = match.groups) === null || _a === void 0 ? void 0 : _a.pr)) {
|
|
58
|
+
message = message.replace(match[0], '');
|
|
59
|
+
issues.add(match.groups.pr);
|
|
60
|
+
}
|
|
61
|
+
// Array.from(someSet) will maintain elements in insertion
|
|
62
|
+
// order, given this we add references after the pr suffix.
|
|
63
|
+
for (const ref of commit.references) {
|
|
64
|
+
issues.add(ref.issue);
|
|
65
|
+
}
|
|
49
66
|
const change = {
|
|
50
67
|
type: commit.type,
|
|
51
68
|
sha: commit.sha,
|
|
52
69
|
message: message,
|
|
53
|
-
issues:
|
|
70
|
+
issues: Array.from(issues),
|
|
54
71
|
};
|
|
55
72
|
if (commit.scope)
|
|
56
73
|
change.scope = commit.scope;
|