release-please 15.6.0 → 15.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,25 @@
4
4
 
5
5
  [1]: https://www.npmjs.com/package/release-please?activeTab=versions
6
6
 
7
+ ## [15.8.0](https://github.com/googleapis/release-please/compare/v15.7.0...v15.8.0) (2023-02-15)
8
+
9
+
10
+ ### Features
11
+
12
+ * Scan readme files in java-yoshi-mono-repo strategy ([#1853](https://github.com/googleapis/release-please/issues/1853)) ([635cc7d](https://github.com/googleapis/release-please/commit/635cc7d03820d539f470c151db410dd2a8d29eae))
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * Github issues link ([#1849](https://github.com/googleapis/release-please/issues/1849)) ([68e6759](https://github.com/googleapis/release-please/commit/68e67591bbae5db51ce0ce7591898a2adf49be96))
18
+
19
+ ## [15.7.0](https://github.com/googleapis/release-please/compare/v15.6.0...v15.7.0) (2023-02-07)
20
+
21
+
22
+ ### Features
23
+
24
+ * **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))
25
+
7
26
  ## [15.6.0](https://github.com/googleapis/release-please/compare/v15.5.1...v15.6.0) (2023-02-01)
8
27
 
9
28
 
@@ -312,7 +312,7 @@ class GitHub {
312
312
  * @throws {GitHubAPIError} on an API error
313
313
  */
314
314
  this.commentOnIssue = wrapAsync(async (comment, number) => {
315
- this.logger.debug(`adding comment to https://github.com/${this.repository.owner}/${this.repository.repo}/issue/${number}`);
315
+ this.logger.debug(`adding comment to https://github.com/${this.repository.owner}/${this.repository.repo}/issues/${number}`);
316
316
  const resp = await this.octokit.issues.createComment({
317
317
  owner: this.repository.owner,
318
318
  repo: this.repository.repo,
@@ -85,6 +85,7 @@ class JavaYoshiMonoRepo extends java_1.Java {
85
85
  const pomFilesSearch = this.github.findFilesByFilenameAndRef('pom.xml', this.targetBranch, this.path);
86
86
  const buildFilesSearch = this.github.findFilesByFilenameAndRef('build.gradle', this.targetBranch, this.path);
87
87
  const dependenciesSearch = this.github.findFilesByFilenameAndRef('dependencies.properties', this.targetBranch, this.path);
88
+ const readmeFilesSearch = this.github.findFilesByFilenameAndRef('README.md', this.targetBranch, this.path);
88
89
  const pomFiles = await pomFilesSearch;
89
90
  pomFiles.forEach(path => {
90
91
  updates.push({
@@ -121,6 +122,18 @@ class JavaYoshiMonoRepo extends java_1.Java {
121
122
  }),
122
123
  });
123
124
  });
125
+ const readmeFiles = await readmeFilesSearch;
126
+ readmeFiles.forEach(path => {
127
+ updates.push({
128
+ path: this.addPath(path),
129
+ createIfMissing: false,
130
+ updater: new java_update_1.JavaUpdate({
131
+ version,
132
+ versionsMap,
133
+ isSnapshot: options.isSnapshot,
134
+ }),
135
+ });
136
+ });
124
137
  this.extraFiles.forEach(extraFile => {
125
138
  if (typeof extraFile === 'object') {
126
139
  return;
@@ -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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-please",
3
- "version": "15.6.0",
3
+ "version": "15.8.0",
4
4
  "description": "generate release PRs based on the conventionalcommits.org spec",
5
5
  "main": "./build/src/index.js",
6
6
  "bin": "./build/src/bin/release-please.js",