release-please 13.9.0 → 13.10.2

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,37 @@
4
4
 
5
5
  [1]: https://www.npmjs.com/package/release-please?activeTab=versions
6
6
 
7
+ ### [13.10.2](https://github.com/googleapis/release-please/compare/v13.10.1...v13.10.2) (2022-04-14)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * **java:** snapshots should bump versionsMap versions ([#1386](https://github.com/googleapis/release-please/issues/1386)) ([558331c](https://github.com/googleapis/release-please/commit/558331c160a066daeda476438f6524bf958f8d41)), closes [#1381](https://github.com/googleapis/release-please/issues/1381)
13
+ * **ruby-yoshi:** Remove bolded scope and fix link removal ([#1382](https://github.com/googleapis/release-please/issues/1382)) ([f6b3202](https://github.com/googleapis/release-please/commit/f6b32024998c4e414b723a4071166f253e95b1d2))
14
+
15
+ ### [13.10.1](https://github.com/googleapis/release-please/compare/v13.10.0...v13.10.1) (2022-04-13)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * bump retries for pull request iterator from 1 to 3 ([#1377](https://github.com/googleapis/release-please/issues/1377)) ([b2b7ff8](https://github.com/googleapis/release-please/commit/b2b7ff8ce98714ac591857b194ba0d51d9c2a641)), closes [#1376](https://github.com/googleapis/release-please/issues/1376)
21
+ * don't crash when pull request iterator GraphQL returns no response ([b2b7ff8](https://github.com/googleapis/release-please/commit/b2b7ff8ce98714ac591857b194ba0d51d9c2a641))
22
+ * fixed maxResults check in tag and release iterators ([#1378](https://github.com/googleapis/release-please/issues/1378)) ([6492a86](https://github.com/googleapis/release-please/commit/6492a86c56bbbb9b85f96bdf7edba910f1d66fc0))
23
+ * GraphQL retry now uses exponential backoff ([b2b7ff8](https://github.com/googleapis/release-please/commit/b2b7ff8ce98714ac591857b194ba0d51d9c2a641))
24
+
25
+ ## [13.10.0](https://github.com/googleapis/release-please/compare/v13.9.0...v13.10.0) (2022-04-12)
26
+
27
+
28
+ ### Features
29
+
30
+ * enable overriding release-as ([ffa0f7c](https://github.com/googleapis/release-please/commit/ffa0f7c7b0d0d2b65ce6285b62802ac08951a43c))
31
+ * support selecting a single path when releasing from a manifest ([#1362](https://github.com/googleapis/release-please/issues/1362)) ([ffa0f7c](https://github.com/googleapis/release-please/commit/ffa0f7c7b0d0d2b65ce6285b62802ac08951a43c))
32
+
33
+
34
+ ### Bug Fixes
35
+
36
+ * **rust:** update Cargo.lock for single Rust crate ([#1374](https://github.com/googleapis/release-please/issues/1374)) ([e3571d3](https://github.com/googleapis/release-please/commit/e3571d32c44ae2bef8bac7dd8cdc3556a9d621c7))
37
+
7
38
  ## [13.9.0](https://github.com/googleapis/release-please/compare/v13.8.1...v13.9.0) (2022-04-12)
8
39
 
9
40
 
@@ -290,7 +290,7 @@ const createReleasePullRequestCommand = {
290
290
  }
291
291
  else {
292
292
  const manifestOptions = extractManifestOptions(argv);
293
- manifest = await manifest_1.Manifest.fromManifest(github, targetBranch, argv.configFile, argv.manifestFile, manifestOptions);
293
+ manifest = await manifest_1.Manifest.fromManifest(github, targetBranch, argv.configFile, argv.manifestFile, manifestOptions, argv.path, argv.releaseAs);
294
294
  }
295
295
  if (argv.dryRun) {
296
296
  const pullRequests = await manifest.buildPullRequests();
@@ -59,17 +59,30 @@ class GitHub {
59
59
  return files;
60
60
  });
61
61
  this.graphqlRequest = wrapAsync(async (opts, maxRetries = 1) => {
62
+ let seconds = 1;
62
63
  while (maxRetries >= 0) {
63
64
  try {
64
- return await this.graphql(opts);
65
+ const response = await this.graphql(opts);
66
+ if (response) {
67
+ return response;
68
+ }
69
+ logger_1.logger.trace('no GraphQL response, retrying');
65
70
  }
66
71
  catch (err) {
67
72
  if (err.status !== 502) {
68
73
  throw err;
69
74
  }
75
+ logger_1.logger.trace('received 502 error, retrying');
70
76
  }
71
77
  maxRetries -= 1;
78
+ if (maxRetries >= 0) {
79
+ logger_1.logger.trace(`sleeping ${seconds} seconds`);
80
+ await sleepInMs(1000 * seconds);
81
+ seconds *= 2;
82
+ }
72
83
  }
84
+ logger_1.logger.trace('ran out of retries');
85
+ return undefined;
73
86
  });
74
87
  /**
75
88
  * Returns a list of paths to all files with a given name.
@@ -622,6 +635,7 @@ class GitHub {
622
635
  * @throws {GitHubAPIError} on an API error
623
636
  */
624
637
  async pullRequestsGraphQL(targetBranch, states = 'MERGED', cursor) {
638
+ var _a;
625
639
  logger_1.logger.debug(`Fetching ${states} pull requests on branch ${targetBranch} with cursor ${cursor}`);
626
640
  const response = await this.graphqlRequest({
627
641
  query: `query mergedPullRequests($owner: String!, $repo: String!, $num: Int!, $maxFilesChanged: Int, $targetBranch: String!, $states: [PullRequestState!], $cursor: String) {
@@ -665,8 +679,8 @@ class GitHub {
665
679
  targetBranch,
666
680
  states,
667
681
  maxFilesChanged: 64,
668
- });
669
- if (!response.repository.pullRequests) {
682
+ }, 3);
683
+ if (!((_a = response === null || response === void 0 ? void 0 : response.repository) === null || _a === void 0 ? void 0 : _a.pullRequests)) {
670
684
  logger_1.logger.warn(`Could not find merged pull requests for branch ${targetBranch} - it likely does not exist.`);
671
685
  return null;
672
686
  }
@@ -714,7 +728,7 @@ class GitHub {
714
728
  }
715
729
  yield response.data[i];
716
730
  }
717
- if (!response.pageInfo.hasNextPage) {
731
+ if (results > maxResults || !response.pageInfo.hasNextPage) {
718
732
  break;
719
733
  }
720
734
  cursor = response.pageInfo.endCursor;
@@ -799,6 +813,8 @@ class GitHub {
799
813
  sha: tag.commit.sha,
800
814
  };
801
815
  }
816
+ if (results > maxResults)
817
+ break;
802
818
  }
803
819
  }
804
820
  /**
@@ -975,4 +991,5 @@ const wrapAsync = (fn, errorHandler) => {
975
991
  }
976
992
  };
977
993
  };
994
+ const sleepInMs = (ms) => new Promise(resolve => setTimeout(resolve, ms));
978
995
  //# sourceMappingURL=github.js.map
@@ -192,9 +192,10 @@ export declare class Manifest {
192
192
  * @param {string} targetBranch The releaseable base branch
193
193
  * @param {string} configFile Optional. The path to the manifest config file
194
194
  * @param {string} manifestFile Optional. The path to the manifest versions file
195
+ * @param {string} path The single path to check. Optional
195
196
  * @returns {Manifest}
196
197
  */
197
- static fromManifest(github: GitHub, targetBranch: string, configFile?: string, manifestFile?: string, manifestOptionOverrides?: ManifestOptions): Promise<Manifest>;
198
+ static fromManifest(github: GitHub, targetBranch: string, configFile?: string, manifestFile?: string, manifestOptionOverrides?: ManifestOptions, path?: string, releaseAs?: string): Promise<Manifest>;
198
199
  /**
199
200
  * Create a Manifest from explicit config in code. This assumes that the
200
201
  * repository has a single component at the root path.
@@ -91,11 +91,12 @@ class Manifest {
91
91
  * @param {string} targetBranch The releaseable base branch
92
92
  * @param {string} configFile Optional. The path to the manifest config file
93
93
  * @param {string} manifestFile Optional. The path to the manifest versions file
94
+ * @param {string} path The single path to check. Optional
94
95
  * @returns {Manifest}
95
96
  */
96
- static async fromManifest(github, targetBranch, configFile = exports.DEFAULT_RELEASE_PLEASE_CONFIG, manifestFile = exports.DEFAULT_RELEASE_PLEASE_MANIFEST, manifestOptionOverrides = {}) {
97
+ static async fromManifest(github, targetBranch, configFile = exports.DEFAULT_RELEASE_PLEASE_CONFIG, manifestFile = exports.DEFAULT_RELEASE_PLEASE_MANIFEST, manifestOptionOverrides = {}, path, releaseAs) {
97
98
  const [{ config: repositoryConfig, options: manifestOptions }, releasedVersions,] = await Promise.all([
98
- parseConfig(github, configFile, targetBranch),
99
+ parseConfig(github, configFile, targetBranch, path, releaseAs),
99
100
  parseReleasedVersions(github, manifestFile, targetBranch),
100
101
  ]);
101
102
  return new Manifest(github, targetBranch, repositoryConfig, releasedVersions, {
@@ -690,13 +691,20 @@ function extractReleaserConfig(config) {
690
691
  * @param {GitHub} github GitHub client
691
692
  * @param {string} configFile Path in the repository to the manifest config
692
693
  * @param {string} branch Branch to fetch the config file from
694
+ * @param {string} onlyPath Optional. Use only the given package
695
+ * @param {string} releaseAs Optional. Override release-as and use the given version
693
696
  */
694
- async function parseConfig(github, configFile, branch) {
697
+ async function parseConfig(github, configFile, branch, onlyPath, releaseAs) {
695
698
  const config = await github.getFileJson(configFile, branch);
696
699
  const defaultConfig = extractReleaserConfig(config);
697
700
  const repositoryConfig = {};
698
701
  for (const path in config.packages) {
702
+ if (onlyPath && onlyPath !== path)
703
+ continue;
699
704
  repositoryConfig[path] = mergeReleaserConfig(defaultConfig, extractReleaserConfig(config.packages[path]));
705
+ if (releaseAs) {
706
+ repositoryConfig[path].releaseAs = releaseAs;
707
+ }
700
708
  }
701
709
  const configLabel = config['label'];
702
710
  const configReleaseLabel = config['release-label'];
@@ -204,14 +204,8 @@ class BaseStrategy {
204
204
  return changelogEntry.split('\n').length <= 1;
205
205
  }
206
206
  async updateVersionsMap(versionsMap, conventionalCommits, _newVersion) {
207
- for (const versionKey of versionsMap.keys()) {
208
- const version = versionsMap.get(versionKey);
209
- if (!version) {
210
- logger_1.logger.warn(`didn't find version for ${versionKey}`);
211
- continue;
212
- }
213
- const newVersion = await this.versioningStrategy.bump(version, conventionalCommits);
214
- versionsMap.set(versionKey, newVersion);
207
+ for (const [component, version] of versionsMap.entries()) {
208
+ versionsMap.set(component, await this.versioningStrategy.bump(version, conventionalCommits));
215
209
  }
216
210
  return versionsMap;
217
211
  }
@@ -70,6 +70,9 @@ class Java extends base_1.BaseStrategy {
70
70
  ? await this.snapshotVersioning.bump(latestRelease.tag.version, [])
71
71
  : this.initialReleaseVersion();
72
72
  const versionsMap = await this.buildVersionsMap([]);
73
+ for (const [component, version] of versionsMap.entries()) {
74
+ versionsMap.set(component, await this.snapshotVersioning.bump(version, []));
75
+ }
73
76
  const pullRequestTitle = pull_request_title_1.PullRequestTitle.ofComponentTargetBranchVersion(component || '', this.targetBranch, newVersion);
74
77
  const branchName = component
75
78
  ? branch_name_1.BranchName.ofComponentTargetBranch(component, this.targetBranch)
@@ -82,8 +82,10 @@ class RubyYoshi extends base_1.BaseStrategy {
82
82
  return (releaseNotes
83
83
  // Remove links in version title line and standardize on h3
84
84
  .replace(/^###? \[([\d.]+)\]\([^)]*\)/gm, '### $1')
85
+ // Remove bolded scope from change lines
86
+ .replace(/^\* \*\*[\w-]+:\*\* /gm, '* ')
85
87
  // Remove PR and commit links from pull request title suffixes
86
- .replace(/ \(\[#\d+\]\([^)]*\)\)( \(\[\w+\]\([^)]*\)\))?\s*$/gm, '')
88
+ .replace(/( \(\[(\w+|#\d+)\]\(https:\/\/github\.com\/[^)]*\)\))+\s*$/gm, '')
87
89
  // Standardize on h4 for change type subheaders
88
90
  .replace(/^### (Features|Bug Fixes|Documentation)$/gm, '#### $1')
89
91
  // Collapse 2 or more blank lines
@@ -88,10 +88,16 @@ class Rust extends base_1.BaseStrategy {
88
88
  });
89
89
  }
90
90
  else {
91
- const manifestPath = this.addPath('Cargo.toml');
92
- logger_1.logger.info(`single crate found, updating ${manifestPath}`);
91
+ logger_1.logger.info('single crate found, updating Cargo.toml');
92
+ const packageName = await this.getDefaultPackageName();
93
+ if (packageName) {
94
+ versionsMap.set(packageName, version);
95
+ }
96
+ else {
97
+ logger_1.logger.warn('No crate package name found');
98
+ }
93
99
  updates.push({
94
- path: manifestPath,
100
+ path: this.addPath('Cargo.toml'),
95
101
  createIfMissing: false,
96
102
  updater: new cargo_toml_1.CargoToml({
97
103
  version,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-please",
3
- "version": "13.9.0",
3
+ "version": "13.10.2",
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",
@@ -59,7 +59,7 @@
59
59
  "gts": "^3.0.0",
60
60
  "mocha": "^9.0.0",
61
61
  "nock": "^13.0.0",
62
- "sinon": "13.0.1",
62
+ "sinon": "13.0.2",
63
63
  "snap-shot-it": "^7.0.0"
64
64
  },
65
65
  "dependencies": {