release-please 16.10.2 → 16.12.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/README.md CHANGED
@@ -207,7 +207,7 @@ There are a variety of ways you can deploy release-please:
207
207
 
208
208
  ### GitHub Action (recommended)
209
209
 
210
- The easiest way to run Release Please is as a GitHub action. Please see [google-github-actions/release-please-action](https://github.com/google-github-actions/release-please-action) for installation and configuration instructions.
210
+ The easiest way to run Release Please is as a GitHub action. Please see [googleapis/release-please-action](https://github.com/googleapis/release-please-action) for installation and configuration instructions.
211
211
 
212
212
  ### Running as CLI
213
213
 
@@ -14,4 +14,4 @@ export { Logger, setLogger } from './util/logger';
14
14
  export { GitHub } from './github';
15
15
  export declare const configSchema: any;
16
16
  export declare const manifestSchema: any;
17
- export declare const VERSION = "16.10.2";
17
+ export declare const VERSION = "16.12.0";
@@ -36,6 +36,6 @@ Object.defineProperty(exports, "GitHub", { enumerable: true, get: function () {
36
36
  exports.configSchema = require('../../schemas/config.json');
37
37
  exports.manifestSchema = require('../../schemas/manifest.json');
38
38
  // x-release-please-start-version
39
- exports.VERSION = '16.10.2';
39
+ exports.VERSION = '16.12.0';
40
40
  // x-release-please-end
41
41
  //# sourceMappingURL=index.js.map
@@ -687,7 +687,11 @@ class Manifest {
687
687
  this.logger.info(`Creating ${releases.length} releases for pull #${pullRequest.number}`);
688
688
  const duplicateReleases = [];
689
689
  const githubReleases = [];
690
+ let error;
690
691
  for (const release of releases) {
692
+ // stop releasing once we hit an error
693
+ if (error)
694
+ continue;
691
695
  try {
692
696
  githubReleases.push(await this.createRelease(release));
693
697
  }
@@ -697,10 +701,21 @@ class Manifest {
697
701
  duplicateReleases.push(err);
698
702
  }
699
703
  else {
700
- throw err;
704
+ error = err;
701
705
  }
702
706
  }
703
707
  }
708
+ if (githubReleases.length > 0) {
709
+ // comment on pull request about the successful releases
710
+ const releaseList = githubReleases
711
+ .map(({ tagName, url }) => `- [${tagName}](${url})`)
712
+ .join('\n');
713
+ const comment = `:robot: Created releases:\n${releaseList}\n:sunflower:`;
714
+ await this.github.commentOnIssue(comment, pullRequest.number);
715
+ }
716
+ if (error) {
717
+ throw error;
718
+ }
704
719
  if (duplicateReleases.length > 0) {
705
720
  if (duplicateReleases.length + githubReleases.length ===
706
721
  releases.length) {
@@ -726,9 +741,6 @@ class Manifest {
726
741
  draft: release.draft,
727
742
  prerelease: release.prerelease,
728
743
  });
729
- // comment on pull request
730
- const comment = `:robot: Release is at ${githubRelease.url} :sunflower:`;
731
- await this.github.commentOnIssue(comment, release.pullRequest.number);
732
744
  return {
733
745
  ...githubRelease,
734
746
  path: release.path,
@@ -55,6 +55,13 @@ class PHPYoshi extends base_1.BaseStrategy {
55
55
  this.logger.info(`No commits for path: ${this.path}, skipping`);
56
56
  return undefined;
57
57
  }
58
+ const versionOverrides = {};
59
+ commits.forEach(commit => {
60
+ var _a;
61
+ Object.entries(parseVersionOverrides(((_a = commit.pullRequest) === null || _a === void 0 ? void 0 : _a.body) || '')).forEach(([directory, version]) => {
62
+ versionOverrides[directory] = version;
63
+ });
64
+ });
58
65
  const newVersion = latestRelease
59
66
  ? await this.versioningStrategy.bump(latestRelease.tag.version, conventionalCommits)
60
67
  : this.initialReleaseVersion();
@@ -69,13 +76,14 @@ class PHPYoshi extends base_1.BaseStrategy {
69
76
  for (const directory of topLevelDirectories) {
70
77
  try {
71
78
  const contents = await this.github.getFileContentsOnBranch(this.addPath(`${directory}/VERSION`), this.targetBranch);
72
- const version = version_1.Version.parse(contents.parsedContent);
73
79
  const composer = await this.github.getFileJson(this.addPath(`${directory}/composer.json`), this.targetBranch);
74
80
  directoryVersionContents[directory] = {
75
81
  versionContents: contents,
76
82
  composer,
77
83
  };
78
- const newVersion = await this.versioningStrategy.bump(version, splitCommits[directory]);
84
+ const newVersion = versionOverrides[directory]
85
+ ? version_1.Version.parse(versionOverrides[directory])
86
+ : await this.versioningStrategy.bump(version_1.Version.parse(contents.parsedContent), splitCommits[directory]);
79
87
  versionsMap.set(composer.name, newVersion);
80
88
  const partialReleaseNotes = await this.changelogNotes.buildNotes(splitCommits[directory], {
81
89
  host: this.changelogHost,
@@ -211,6 +219,22 @@ class PHPYoshi extends base_1.BaseStrategy {
211
219
  }
212
220
  }
213
221
  exports.PHPYoshi = PHPYoshi;
222
+ function parseVersionOverrides(body) {
223
+ // look for 'BEGIN_VERSION_OVERRIDE' section of pull request body
224
+ const versionOverrides = {};
225
+ if (body) {
226
+ const overrideMessage = (body.split('BEGIN_VERSION_OVERRIDE')[1] || '')
227
+ .split('END_VERSION_OVERRIDE')[0]
228
+ .trim();
229
+ if (overrideMessage) {
230
+ overrideMessage.split('\n').forEach(line => {
231
+ const [directory, version] = line.split(':');
232
+ versionOverrides[directory.trim()] = version.trim();
233
+ });
234
+ }
235
+ }
236
+ return versionOverrides;
237
+ }
214
238
  function updatePHPChangelogEntry(pkgKey, changelogEntry, entryUpdate) {
215
239
  // Remove the first line of the entry, in favor of <summary>.
216
240
  // This also allows us to use the same regex for extracting release
@@ -35,6 +35,7 @@ export declare class PackageJson extends DefaultUpdater {
35
35
  * @param {Version} newVersion The new version to update with
36
36
  */
37
37
  export declare function newVersionWithRange(oldVersion: string, newVersion: Version): string;
38
+ export declare const NPM_PROTOCOL_REGEXP: RegExp;
38
39
  /**
39
40
  * Helper function to update dependency versions for all new versions specified
40
41
  * in the updated versions map. Note that this mutates the existing input.
@@ -13,7 +13,7 @@
13
13
  // See the License for the specific language governing permissions and
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.updateDependencies = exports.newVersionWithRange = exports.PackageJson = void 0;
16
+ exports.updateDependencies = exports.NPM_PROTOCOL_REGEXP = exports.newVersionWithRange = exports.PackageJson = void 0;
17
17
  const json_stringify_1 = require("../../util/json-stringify");
18
18
  const logger_1 = require("../../util/logger");
19
19
  const default_1 = require("../default");
@@ -82,6 +82,7 @@ function newVersionWithRange(oldVersion, newVersion) {
82
82
  return newVersion.toString();
83
83
  }
84
84
  exports.newVersionWithRange = newVersionWithRange;
85
+ exports.NPM_PROTOCOL_REGEXP = /^[a-z]+:/;
85
86
  /**
86
87
  * Helper function to update dependency versions for all new versions specified
87
88
  * in the updated versions map. Note that this mutates the existing input.
@@ -91,9 +92,12 @@ exports.newVersionWithRange = newVersionWithRange;
91
92
  */
92
93
  function updateDependencies(dependencies, updatedVersions) {
93
94
  for (const depName of Object.keys(dependencies)) {
95
+ const oldVersion = dependencies[depName];
96
+ if (exports.NPM_PROTOCOL_REGEXP.test(oldVersion)) {
97
+ continue;
98
+ }
94
99
  const newVersion = updatedVersions.get(depName);
95
100
  if (newVersion) {
96
- const oldVersion = dependencies[depName];
97
101
  dependencies[depName] = newVersionWithRange(oldVersion, newVersion);
98
102
  }
99
103
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-please",
3
- "version": "16.10.2",
3
+ "version": "16.12.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",
@@ -50,7 +50,7 @@
50
50
  "@types/npmlog": "^7.0.0",
51
51
  "@types/pino": "^7.0.0",
52
52
  "@types/semver": "^7.0.0",
53
- "@types/sinon": "^10.0.0",
53
+ "@types/sinon": "^17.0.0",
54
54
  "@types/xmldom": "^0.1.31",
55
55
  "@types/yargs": "^17.0.0",
56
56
  "ajv": "^8.11.0",
@@ -62,7 +62,7 @@
62
62
  "gts": "^3.1.0",
63
63
  "mocha": "^9.2.2",
64
64
  "nock": "^13.0.0",
65
- "sinon": "16.0.0",
65
+ "sinon": "18.0.0",
66
66
  "snap-shot-it": "^7.0.0"
67
67
  },
68
68
  "dependencies": {
@@ -21,7 +21,7 @@
21
21
  "type": "boolean"
22
22
  },
23
23
  "prerelease-type": {
24
- "description": "Configuration option for the prerelese versioning strategy. If prerelease strategy used and type set, will set the prerelese part of the version to the provided value in case prerelease part is not present.",
24
+ "description": "Configuration option for the prerelease versioning strategy. If prerelease strategy used and type set, will set the prerelease part of the version to the provided value in case prerelease part is not present.",
25
25
  "type": "string"
26
26
  },
27
27
  "versioning": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"readme.js","sourceRoot":"","sources":["../../../../src/updaters/terraform/readme.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,kDAAkD;AAClD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAEjC,wCAA0C;AAE1C;;GAEG;AACH,MAAa,MAAO,SAAQ,wBAAc;IACxC;;;;OAIG;IACH,aAAa,CAAC,OAAe;QAC3B,OAAO,OAAO,CAAC,OAAO,CACpB,4BAA4B,EAC5B,iBAAiB,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,CAC7D,CAAC;IACJ,CAAC;CACF;AAZD,wBAYC"}