release-please 13.1.1 → 13.2.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,18 @@
4
4
 
5
5
  [1]: https://www.npmjs.com/package/release-please?activeTab=versions
6
6
 
7
+ ## [13.2.0](https://github.com/googleapis/release-please/compare/v13.1.1...v13.2.0) (2022-01-11)
8
+
9
+
10
+ ### Features
11
+
12
+ * allow prerelease releases on Github ([#1181](https://github.com/googleapis/release-please/issues/1181)) ([267dbfc](https://github.com/googleapis/release-please/commit/267dbfc58a50cde7ffa378b357df62066a1218c9))
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * java snapshots should update all files with :current annotations ([#1204](https://github.com/googleapis/release-please/issues/1204)) ([6f3ae8b](https://github.com/googleapis/release-please/commit/6f3ae8b58afb6673dab2f49daa3d17fbbbef352c))
18
+
7
19
  ### [13.1.1](https://www.github.com/googleapis/release-please/compare/v13.1.0...v13.1.1) (2022-01-03)
8
20
 
9
21
 
@@ -39,6 +39,7 @@ interface ManifestConfigArgs {
39
39
  }
40
40
  interface ReleaseArgs {
41
41
  draft?: boolean;
42
+ prerelease?: boolean;
42
43
  releaseLabel?: string;
43
44
  label?: string;
44
45
  }
@@ -76,6 +76,12 @@ function releaseOptions(yargs) {
76
76
  'tag creation upon "un-drafting" the release.',
77
77
  type: 'boolean',
78
78
  default: false,
79
+ })
80
+ .option('prerelease', {
81
+ describe: 'mark release that have prerelease versions ' +
82
+ 'as as a prerelease on Github',
83
+ type: 'boolean',
84
+ default: false,
79
85
  })
80
86
  .option('label', {
81
87
  default: 'autorelease: pending',
@@ -316,6 +322,7 @@ const createReleaseCommand = {
316
322
  component: argv.component,
317
323
  packageName: argv.packageName,
318
324
  draft: argv.draft,
325
+ prerelease: argv.prerelease,
319
326
  includeComponentInTag: argv.monorepoTags,
320
327
  }, extractManifestOptions(argv), argv.path);
321
328
  }
@@ -419,6 +426,7 @@ const bootstrapCommand = {
419
426
  component: argv.component,
420
427
  packageName: argv.packageName,
421
428
  draft: argv.draft,
429
+ prerelease: argv.prerelease,
422
430
  draftPullRequest: argv.draftPullRequest,
423
431
  bumpMinorPreMajor: argv.bumpMinorPreMajor,
424
432
  bumpPatchForMinorPreMajor: argv.bumpPatchForMinorPreMajor,
@@ -46,6 +46,10 @@ interface ReleaseIteratorOptions {
46
46
  interface TagIteratorOptions {
47
47
  maxResults?: number;
48
48
  }
49
+ export interface ReleaseOptions {
50
+ draft?: boolean;
51
+ prerelease?: boolean;
52
+ }
49
53
  export interface GitHubRelease {
50
54
  name?: string;
51
55
  tagName: string;
@@ -306,13 +310,11 @@ export declare class GitHub {
306
310
  * Create a GitHub release
307
311
  *
308
312
  * @param {Release} release Release parameters
309
- * @param {boolean} draft Whether or not to create the release as a draft
313
+ * @param {ReleaseOptions} options Release option parameters
310
314
  * @throws {DuplicateReleaseError} if the release tag already exists
311
315
  * @throws {GitHubAPIError} on other API errors
312
316
  */
313
- createRelease: (release: Release, options?: {
314
- draft?: boolean | undefined;
315
- } | undefined) => Promise<GitHubRelease>;
317
+ createRelease: (release: Release, options?: ReleaseOptions | undefined) => Promise<GitHubRelease>;
316
318
  /**
317
319
  * Makes a comment on a issue/pull request.
318
320
  *
@@ -293,7 +293,7 @@ class GitHub {
293
293
  * Create a GitHub release
294
294
  *
295
295
  * @param {Release} release Release parameters
296
- * @param {boolean} draft Whether or not to create the release as a draft
296
+ * @param {ReleaseOptions} options Release option parameters
297
297
  * @throws {DuplicateReleaseError} if the release tag already exists
298
298
  * @throws {GitHubAPIError} on other API errors
299
299
  */
@@ -306,6 +306,7 @@ class GitHub {
306
306
  body: release.notes,
307
307
  sha: release.sha,
308
308
  draft: !!options.draft,
309
+ prerelease: !!options.prerelease,
309
310
  });
310
311
  return {
311
312
  name: resp.data.name || undefined,
@@ -651,39 +652,39 @@ class GitHub {
651
652
  logger_1.logger.debug(`Fetching ${states} pull requests on branch ${targetBranch} with cursor ${cursor}`);
652
653
  const response = await this.graphqlRequest({
653
654
  query: `query mergedPullRequests($owner: String!, $repo: String!, $num: Int!, $maxFilesChanged: Int, $targetBranch: String!, $states: [PullRequestState!], $cursor: String) {
654
- repository(owner: $owner, name: $repo) {
655
- pullRequests(first: $num, after: $cursor, baseRefName: $targetBranch, states: $states, orderBy: {field: CREATED_AT, direction: DESC}) {
656
- nodes {
657
- number
658
- title
659
- baseRefName
660
- headRefName
661
- labels(first: 10) {
662
- nodes {
663
- name
664
- }
655
+ repository(owner: $owner, name: $repo) {
656
+ pullRequests(first: $num, after: $cursor, baseRefName: $targetBranch, states: $states, orderBy: {field: CREATED_AT, direction: DESC}) {
657
+ nodes {
658
+ number
659
+ title
660
+ baseRefName
661
+ headRefName
662
+ labels(first: 10) {
663
+ nodes {
664
+ name
665
665
  }
666
- body
667
- mergeCommit {
668
- oid
666
+ }
667
+ body
668
+ mergeCommit {
669
+ oid
670
+ }
671
+ files(first: $maxFilesChanged) {
672
+ nodes {
673
+ path
669
674
  }
670
- files(first: $maxFilesChanged) {
671
- nodes {
672
- path
673
- }
674
- pageInfo {
675
- endCursor
676
- hasNextPage
677
- }
675
+ pageInfo {
676
+ endCursor
677
+ hasNextPage
678
678
  }
679
679
  }
680
- pageInfo {
681
- endCursor
682
- hasNextPage
683
- }
680
+ }
681
+ pageInfo {
682
+ endCursor
683
+ hasNextPage
684
684
  }
685
685
  }
686
- }`,
686
+ }
687
+ }`,
687
688
  cursor,
688
689
  owner: this.repository.owner,
689
690
  repo: this.repository.repo,
@@ -16,6 +16,7 @@ export interface ReleaserConfig {
16
16
  releaseAs?: string;
17
17
  skipGithubRelease?: boolean;
18
18
  draft?: boolean;
19
+ prerelease?: boolean;
19
20
  draftPullRequest?: boolean;
20
21
  component?: string;
21
22
  packageName?: string;
@@ -34,8 +35,9 @@ export interface CandidateReleasePullRequest {
34
35
  }
35
36
  export interface CandidateRelease extends Release {
36
37
  pullRequest: PullRequest;
37
- draft?: boolean;
38
38
  path: string;
39
+ draft?: boolean;
40
+ prerelease?: boolean;
39
41
  }
40
42
  interface ReleaserConfigJson {
41
43
  'release-type'?: ReleaseType;
@@ -45,6 +47,7 @@ interface ReleaserConfigJson {
45
47
  'release-as'?: string;
46
48
  'skip-github-release'?: boolean;
47
49
  draft?: boolean;
50
+ prerelease?: boolean;
48
51
  'draft-pull-request'?: boolean;
49
52
  label?: string;
50
53
  'release-label'?: string;
@@ -66,6 +69,7 @@ export interface ManifestOptions {
66
69
  labels?: string[];
67
70
  releaseLabels?: string[];
68
71
  draft?: boolean;
72
+ prerelease?: boolean;
69
73
  draftPullRequest?: boolean;
70
74
  }
71
75
  interface ReleaserPackageConfig extends ReleaserConfigJson {
@@ -116,6 +120,7 @@ export declare class Manifest {
116
120
  private bootstrapSha?;
117
121
  private lastReleaseSha?;
118
122
  private draft?;
123
+ private prerelease?;
119
124
  private draftPullRequest?;
120
125
  /**
121
126
  * Create a Manifest from explicit config in code. This assumes that the
@@ -439,6 +439,9 @@ class Manifest {
439
439
  path,
440
440
  pullRequest,
441
441
  draft: (_a = config.draft) !== null && _a !== void 0 ? _a : this.draft,
442
+ prerelease: config.prerelease &&
443
+ (!!release.tag.version.preRelease ||
444
+ release.tag.version.major === 0),
442
445
  });
443
446
  }
444
447
  }
@@ -488,6 +491,7 @@ class Manifest {
488
491
  async createRelease(release) {
489
492
  const githubRelease = await this.github.createRelease(release, {
490
493
  draft: release.draft,
494
+ prerelease: release.prerelease,
491
495
  });
492
496
  // comment on pull request
493
497
  const comment = `:robot: Release is at ${githubRelease.url} :sunflower:`;
@@ -553,6 +557,7 @@ function extractReleaserConfig(config) {
553
557
  releaseAs: config['release-as'],
554
558
  skipGithubRelease: config['skip-github-release'],
555
559
  draft: config.draft,
560
+ prerelease: config.prerelease,
556
561
  draftPullRequest: config['draft-pull-request'],
557
562
  component: config['component'],
558
563
  packageName: config['package-name'],
@@ -696,7 +701,7 @@ async function latestReleaseVersion(github, targetBranch, prefix, pullRequestTit
696
701
  return candidateTagVersion.sort((a, b) => b.compare(a))[0];
697
702
  }
698
703
  function mergeReleaserConfig(defaultConfig, pathConfig) {
699
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
704
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
700
705
  return {
701
706
  releaseType: (_b = (_a = pathConfig.releaseType) !== null && _a !== void 0 ? _a : defaultConfig.releaseType) !== null && _b !== void 0 ? _b : 'node',
702
707
  bumpMinorPreMajor: (_c = pathConfig.bumpMinorPreMajor) !== null && _c !== void 0 ? _c : defaultConfig.bumpMinorPreMajor,
@@ -706,10 +711,11 @@ function mergeReleaserConfig(defaultConfig, pathConfig) {
706
711
  releaseAs: (_g = pathConfig.releaseAs) !== null && _g !== void 0 ? _g : defaultConfig.releaseAs,
707
712
  skipGithubRelease: (_h = pathConfig.skipGithubRelease) !== null && _h !== void 0 ? _h : defaultConfig.skipGithubRelease,
708
713
  draft: (_j = pathConfig.draft) !== null && _j !== void 0 ? _j : defaultConfig.draft,
709
- component: (_k = pathConfig.component) !== null && _k !== void 0 ? _k : defaultConfig.component,
710
- packageName: (_l = pathConfig.packageName) !== null && _l !== void 0 ? _l : defaultConfig.packageName,
711
- versionFile: (_m = pathConfig.versionFile) !== null && _m !== void 0 ? _m : defaultConfig.versionFile,
712
- extraFiles: (_o = pathConfig.extraFiles) !== null && _o !== void 0 ? _o : defaultConfig.extraFiles,
714
+ prerelease: (_k = pathConfig.prerelease) !== null && _k !== void 0 ? _k : defaultConfig.prerelease,
715
+ component: (_l = pathConfig.component) !== null && _l !== void 0 ? _l : defaultConfig.component,
716
+ packageName: (_m = pathConfig.packageName) !== null && _m !== void 0 ? _m : defaultConfig.packageName,
717
+ versionFile: (_o = pathConfig.versionFile) !== null && _o !== void 0 ? _o : defaultConfig.versionFile,
718
+ extraFiles: (_p = pathConfig.extraFiles) !== null && _p !== void 0 ? _p : defaultConfig.extraFiles,
713
719
  };
714
720
  }
715
721
  /**
@@ -5,6 +5,9 @@ import { GitHubFileContents } from '../github';
5
5
  import { Commit, ConventionalCommit } from '../commit';
6
6
  import { Release } from '../release';
7
7
  import { ReleasePullRequest } from '../release-pull-request';
8
+ interface JavaBuildUpdatesOption extends BuildUpdatesOptions {
9
+ isSnapshot?: boolean;
10
+ }
8
11
  export declare class JavaYoshi extends BaseStrategy {
9
12
  private versionsContent?;
10
13
  private snapshotVersioning;
@@ -14,7 +17,8 @@ export declare class JavaYoshi extends BaseStrategy {
14
17
  private needsSnapshot;
15
18
  protected buildVersionsMap(): Promise<VersionsMap>;
16
19
  protected getVersionsContent(): Promise<GitHubFileContents>;
17
- protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
20
+ protected buildUpdates(options: JavaBuildUpdatesOption): Promise<Update[]>;
18
21
  protected updateVersionsMap(versionsMap: VersionsMap, conventionalCommits: ConventionalCommit[]): Promise<VersionsMap>;
19
22
  protected initialReleaseVersion(): Version;
20
23
  }
24
+ export {};
@@ -78,26 +78,24 @@ class JavaYoshi extends base_1.BaseStrategy {
78
78
  const branchName = component
79
79
  ? branch_name_1.BranchName.ofComponentTargetBranch(component, this.targetBranch)
80
80
  : branch_name_1.BranchName.ofTargetBranch(this.targetBranch);
81
+ const notes = '### Updating meta-information for bleeding-edge SNAPSHOT release.';
81
82
  const pullRequestBody = new pull_request_body_1.PullRequestBody([
82
83
  {
83
84
  component,
84
85
  version: newVersion,
85
- notes: '### Updating meta-information for bleeding-edge SNAPSHOT release.',
86
+ notes,
86
87
  },
87
88
  ]);
89
+ const updates = await this.buildUpdates({
90
+ newVersion,
91
+ versionsMap,
92
+ changelogEntry: notes,
93
+ isSnapshot: true,
94
+ });
88
95
  return {
89
96
  title: pullRequestTitle,
90
97
  body: pullRequestBody,
91
- updates: [
92
- {
93
- path: this.addPath('versions.txt'),
94
- createIfMissing: false,
95
- updater: new versions_manifest_1.VersionsManifest({
96
- version: newVersion,
97
- versionsMap,
98
- }),
99
- },
100
- ],
98
+ updates,
101
99
  labels: [],
102
100
  headRefName: branchName.toString(),
103
101
  version: newVersion,
@@ -149,6 +147,7 @@ class JavaYoshi extends base_1.BaseStrategy {
149
147
  updater: new java_update_1.JavaUpdate({
150
148
  version,
151
149
  versionsMap,
150
+ isSnapshot: options.isSnapshot,
152
151
  }),
153
152
  });
154
153
  });
@@ -160,6 +159,7 @@ class JavaYoshi extends base_1.BaseStrategy {
160
159
  updater: new java_update_1.JavaUpdate({
161
160
  version,
162
161
  versionsMap,
162
+ isSnapshot: options.isSnapshot,
163
163
  }),
164
164
  });
165
165
  });
@@ -171,6 +171,7 @@ class JavaYoshi extends base_1.BaseStrategy {
171
171
  updater: new java_update_1.JavaUpdate({
172
172
  version,
173
173
  versionsMap,
174
+ isSnapshot: options.isSnapshot,
174
175
  }),
175
176
  });
176
177
  });
@@ -181,17 +182,20 @@ class JavaYoshi extends base_1.BaseStrategy {
181
182
  updater: new java_update_1.JavaUpdate({
182
183
  version,
183
184
  versionsMap,
185
+ isSnapshot: options.isSnapshot,
184
186
  }),
185
187
  });
186
188
  });
187
- updates.push({
188
- path: this.addPath(this.changelogPath),
189
- createIfMissing: true,
190
- updater: new changelog_1.Changelog({
191
- version,
192
- changelogEntry: options.changelogEntry,
193
- }),
194
- });
189
+ if (!options.isSnapshot) {
190
+ updates.push({
191
+ path: this.addPath(this.changelogPath),
192
+ createIfMissing: true,
193
+ updater: new changelog_1.Changelog({
194
+ version,
195
+ changelogEntry: options.changelogEntry,
196
+ }),
197
+ });
198
+ }
195
199
  return updates;
196
200
  }
197
201
  async updateVersionsMap(versionsMap, conventionalCommits) {
@@ -1,10 +1,15 @@
1
- import { DefaultUpdater } from '../default';
1
+ import { DefaultUpdater, UpdateOptions } from '../default';
2
+ interface JavaUpdateOptions extends UpdateOptions {
3
+ isSnapshot?: boolean;
4
+ }
2
5
  /**
3
6
  * Updates a file annotated with region markers. These region markers are
4
7
  * either denoted inline with `{x-version-update:<component-name>:current|released}`
5
8
  * or with a `{x-version-update-start:<component-name>}` and `{x-version-update-end}`.
6
9
  */
7
10
  export declare class JavaUpdate extends DefaultUpdater {
11
+ isSnapshot: boolean;
12
+ constructor(options: JavaUpdateOptions);
8
13
  /**
9
14
  * Given initial file contents, return updated contents.
10
15
  * @param {string} content The initial content
@@ -12,3 +17,4 @@ export declare class JavaUpdate extends DefaultUpdater {
12
17
  */
13
18
  updateContent(content: string): string;
14
19
  }
20
+ export {};
@@ -26,6 +26,10 @@ const VERSION_REGEX = /\d+\.\d+\.\d+(-\w+(\.\d+)?)?(-SNAPSHOT)?/;
26
26
  * or with a `{x-version-update-start:<component-name>}` and `{x-version-update-end}`.
27
27
  */
28
28
  class JavaUpdate extends default_1.DefaultUpdater {
29
+ constructor(options) {
30
+ super(options);
31
+ this.isSnapshot = !!options.isSnapshot;
32
+ }
29
33
  /**
30
34
  * Given initial file contents, return updated contents.
31
35
  * @param {string} content The initial content
@@ -40,7 +44,7 @@ class JavaUpdate extends default_1.DefaultUpdater {
40
44
  let blockPackageName = null;
41
45
  content.split(/\r?\n/).forEach(line => {
42
46
  let match = line.match(INLINE_UPDATE_REGEX);
43
- if (match) {
47
+ if (match && (!this.isSnapshot || match[2] === 'current')) {
44
48
  const newVersion = this.versionsMap.get(match[1]);
45
49
  if (newVersion) {
46
50
  newLines.push(line.replace(VERSION_REGEX, newVersion.toString()));
@@ -63,7 +67,7 @@ class JavaUpdate extends default_1.DefaultUpdater {
63
67
  }
64
68
  else {
65
69
  match = line.match(BLOCK_START_REGEX);
66
- if (match) {
70
+ if (match && (!this.isSnapshot || match[2] === 'current')) {
67
71
  blockPackageName = match[1];
68
72
  }
69
73
  newLines.push(line);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-please",
3
- "version": "13.1.1",
3
+ "version": "13.2.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
  "c8": "^7.0.0",
51
51
  "chai": "^4.2.0",
52
52
  "cross-env": "^7.0.0",
53
- "gts": "^2.0.0",
53
+ "gts": "^3.0.0",
54
54
  "mocha": "^8.0.0",
55
55
  "nock": "^13.0.0",
56
56
  "sinon": "12.0.1",