Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions __snapshots__/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ Options:
with the release for future tag creation upon
"un-drafting" the release.
[boolean] [default: false]
--force-tag-creation Force the creation of a Git tag for the
release. [boolean] [default: false]
--prerelease mark release that have prerelease versions as as
a prerelease on Github[boolean] [default: false]
--label comma-separated list of labels to remove to from
Expand Down Expand Up @@ -140,6 +142,9 @@ Options:
target_commitish are associated with the release for future
tag creation upon "un-drafting" the release.
[boolean] [default: false]
--force-tag-creation
Force the creation of a Git tag for the release.
[boolean] [default: false]
--prerelease mark release that have prerelease versions as as a
prerelease on Github [boolean] [default: false]
--label comma-separated list of labels to remove to from release PR
Expand Down
16 changes: 16 additions & 0 deletions __snapshots__/github.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Extra options:
| `--prerelease-type` | `string` | 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. |
| `--draft` | `boolean` | If set, create releases as drafts |
| `--prerelease` | `boolean` | If set, create releases that are pre-major or pre-release version marked as pre-release on Github |
| `--force-tag-creation` | `boolean` | Force the creation of a Git tag for the release. Useful when `--draft` is enabled, because GitHub does not create a Git tag for draft releases until they are published. This causes release-please to fail to find the previous release, potentially generating incorrect changelogs. Setting this option ensures the tag is created immediately. |
| `--draft-pull-request` | `boolean` | If set, create pull requests as drafts |
| `--label` | `string` | Comma-separated list of labels to apply to the release pull requests. Defaults to `autorelease: pending` |
| `--release-label` | `string` | Comma-separated list of labels to apply to the pull request after the release has been tagged. Defaults to `autorelease: tagged` |
Expand Down Expand Up @@ -158,6 +159,7 @@ need to specify your release options:
| `--pull-request-footer` | `string` | Override the pull request footer. Defaults to `This PR was generated with Release Please. See documentation.` |
| `--draft` | `boolean` | If set, create releases as drafts |
| `--prerelease` | `boolean` | If set, create releases that are pre-major or pre-release version marked as pre-release on Github|
| `--force-tag-creation` | `boolean` | Force the creation of a Git tag for the release. Useful when `--draft` is enabled, because GitHub does not create a Git tag for draft releases until they are published. This causes release-please to fail to find the previous release, potentially generating incorrect changelogs. Setting this option ensures the tag is created immediately. |
| `--label` | `string` | Comma-separated list of labels to apply to the release pull requests. Defaults to `autorelease: pending` |
| `--release-label` | `string` | Comma-separated list of labels to apply to the pull request after the release has been tagged. Defaults to `autorelease: tagged` |
| `--include-v-in-tags` | `boolean` | Include "v" in tag versions. Defaults to `true`. |
Expand Down
13 changes: 12 additions & 1 deletion docs/manifest-releaser.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,18 @@ defaults (those are documented in comments)
// when `manifest-release` creates GitHub Releases per package, create
// those as "Prerelease" releases that have pre-major or prerelease versions.
// absence defaults to false and all versions are fully Published.
"prerelease": true
"prerelease": true,

// Force the creation of a Git tag for the release. This is particularly
// useful when `draft` is enabled. By default, GitHub does not create a Git
// tag for draft releases until they are published. This "lazy tag creation"
// behavior causes release-please to fail to find the previous release when
// running subsequent `release-pr` commands, potentially generating incorrect
// changelogs that include the entire commit history. Setting `force-tag-creation` to
// true ensures the tag is created immediately, allowing release-please to
// correctly identify the previous release.
// Absence defaults to false.
"force-tag-creation": true

// Skip creating GitHub Releases
// Absence defaults to false and Releases will be created. Release-Please still
Expand Down
84 changes: 67 additions & 17 deletions schemas/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@
"type": "boolean"
}
},
"required": ["type", "section"]
"required": [
"type",
"section"
]
}
},
"release-as": {
Expand All @@ -66,6 +69,10 @@
"description": "Create the GitHub release in draft mode. Defaults to `false`.",
"type": "boolean"
},
"force-tag-creation": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please revert all the formatting changes that are not related to this change? Thanks

"description": "Force the creation of a Git tag for the release. This is particularly useful when `draft` is enabled, because GitHub does not create a Git tag for draft releases until they are published. This 'lazy tag creation' causes release-please to fail to find the previous release, potentially generating incorrect changelogs. Setting this to `true` ensures the tag is created immediately. Defaults to `false`.",
"type": "boolean"
},
"prerelease": {
"description": "Create the GitHub release as prerelease. Defaults to `false`.",
"type": "boolean"
Expand All @@ -89,7 +96,10 @@
"changelog-type": {
"description": "The type of changelog to use. Defaults to `default`.",
"type": "string",
"enum": ["default", "github"]
"enum": [
"default",
"github"
]
},
"changelog-host": {
"description": "Generate changelog links to this GitHub host. Useful for running against GitHub Enterprise.",
Expand Down Expand Up @@ -142,7 +152,11 @@
"properties": {
"type": {
"description": "The file format type.",
"enum": ["json", "toml", "yaml"]
"enum": [
"json",
"toml",
"yaml"
]
},
"path": {
"description": "The path to the file.",
Expand All @@ -157,15 +171,21 @@
"type": "string"
}
},
"required": ["type", "path", "jsonpath"]
"required": [
"type",
"path",
"jsonpath"
]
},
{
"description": "An extra XML file with a targeted update via xpath.",
"type": "object",
"properties": {
"type": {
"description": "The file format type.",
"enum": ["xml"]
"enum": [
"xml"
]
},
"path": {
"description": "The path to the file.",
Expand All @@ -180,15 +200,21 @@
"type": "string"
}
},
"required": ["type", "path", "xpath"]
"required": [
"type",
"path",
"xpath"
]
},
{
"description": "An extra pom.xml file.",
"type": "object",
"properties": {
"type": {
"description": "The file format type.",
"enum": ["pom"]
"enum": [
"pom"
]
},
"path": {
"description": "The path to the file.",
Expand All @@ -199,15 +225,20 @@
"type": "boolean"
}
},
"required": ["type", "path"]
"required": [
"type",
"path"
]
},
{
"description": "An extra arbitrary file that includes release-please generic updater's annotation.",
"type": "object",
"properties": {
"type": {
"description": "The file format type.",
"enum": ["generic"]
"enum": [
"generic"
]
},
"path": {
"description": "The path to the file.",
Expand All @@ -218,7 +249,10 @@
"type": "boolean"
}
},
"required": ["type", "path"]
"required": [
"type",
"path"
]
}
]
}
Expand Down Expand Up @@ -299,7 +333,9 @@
"type": {
"description": "The name of the plugin.",
"type": "string",
"enum": ["linked-versions"]
"enum": [
"linked-versions"
]
},
"groupName": {
"description": "The name of the group of components.",
Expand All @@ -324,7 +360,11 @@
}
}
},
"required": ["type", "groupName", "components"]
"required": [
"type",
"groupName",
"components"
]
},
{
"description": "Configuration for various `workspace` plugins.",
Expand All @@ -333,7 +373,10 @@
"type": {
"description": "The name of the plugin.",
"type": "string",
"enum": ["cargo-workspace", "maven-workspace"]
"enum": [
"cargo-workspace",
"maven-workspace"
]
},
"updateAllPackages": {
"description": "Whether to force updating all packages regardless of the dependency tree. Defaults to `false`.",
Expand All @@ -356,7 +399,9 @@
"type": {
"description": "The name of the plugin.",
"type": "string",
"enum": ["node-workspace"]
"enum": [
"node-workspace"
]
},
"updateAllPackages": {
"description": "Whether to force updating all packages regardless of the dependency tree. Defaults to `false`.",
Expand All @@ -383,7 +428,9 @@
"type": {
"description": "The name of the plugin.",
"type": "string",
"enum": ["group-priority"]
"enum": [
"group-priority"
]
},
"groups": {
"description": "Group names ordered with highest priority first.",
Expand Down Expand Up @@ -440,7 +487,9 @@
"type": "boolean"
}
},
"required": ["packages"]
"required": [
"packages"
]
}
],
"properties": {
Expand All @@ -464,6 +513,7 @@
"skip-github-release": true,
"skip-changelog": true,
"draft": true,
"force-tag-creation": true,
"prerelease": true,
"draft-pull-request": true,
"label": true,
Expand All @@ -488,4 +538,4 @@
"exclude-paths": true,
"component-no-space": false
}
}
}
8 changes: 8 additions & 0 deletions src/bin/release-please.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ interface ManifestConfigArgs {

interface ReleaseArgs {
draft?: boolean;
forceTag?: boolean;
prerelease?: boolean;
releaseLabel?: string;
snapshotLabel?: string;
Expand Down Expand Up @@ -206,6 +207,11 @@ function releaseOptions(yargs: yargs.Argv): yargs.Argv {
type: 'boolean',
default: false,
})
.option('force-tag-creation', {
describe: 'Force the creation of a Git tag for the release.',
type: 'boolean',
default: false,
})
.option('prerelease', {
describe:
'mark release that have prerelease versions ' +
Expand Down Expand Up @@ -568,6 +574,7 @@ const createReleaseCommand: yargs.CommandModule<{}, CreateReleaseArgs> = {
component: argv.component,
packageName: argv.packageName,
draft: argv.draft,
forceTag: argv.forceTag,
prerelease: argv.prerelease,
includeComponentInTag: argv.monorepoTags,
includeVInTag: argv.includeVInTags,
Expand Down Expand Up @@ -731,6 +738,7 @@ const bootstrapCommand: yargs.CommandModule<{}, BootstrapArgs> = {
component: argv.component,
packageName: argv.packageName,
draft: argv.draft,
forceTag: argv.forceTag,
prerelease: argv.prerelease,
draftPullRequest: argv.draftPullRequest,
bumpMinorPreMajor: argv.bumpMinorPreMajor,
Expand Down
16 changes: 16 additions & 0 deletions src/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
token?: string;
logger?: Logger;
proxy?: ProxyOption;
fetch?: any;

Check warning on line 86 in src/github.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
}

type CommitFilter = (commit: Commit) => boolean;
Expand Down Expand Up @@ -173,6 +173,7 @@
export interface ReleaseOptions {
draft?: boolean;
prerelease?: boolean;
forceTag?: boolean;
}

export interface GitHubRelease {
Expand Down Expand Up @@ -572,7 +573,7 @@
}
)) {
// Paginate plugin doesn't have types for listing files on a commit
const data = resp.data as any as {files: {filename: string}[]};

Check warning on line 576 in src/github.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
for (const f of data.files || []) {
if (f.filename) {
files.push(f.filename);
Expand Down Expand Up @@ -1391,6 +1392,21 @@
release: Release,
options: ReleaseOptions = {}
): Promise<GitHubRelease> => {
if (options.forceTag) {
try {
await this.octokit.git.createRef({
owner: this.repository.owner,
repo: this.repository.repo,
ref: `refs/tags/${release.tag.toString()}`,
sha: release.sha,
});
} catch (err: any) {

Check warning on line 1403 in src/github.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
// ignore if tag already exists
if (err.status !== 422) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a debug log line when this happens so we have some feedback?

throw err;
}
}
}
const resp = await this.octokit.repos.createRelease({
name: release.name,
owner: this.repository.owner,
Expand Down
Loading
Loading