Add draft release support (fixes #19)

This commit is contained in:
Sven-Hendrik Haase 2024-02-21 22:38:32 +01:00
commit 17449a21ea
No known key found for this signature in database
GPG Key ID: 39E4B877E62EB915
4 changed files with 8296 additions and 34079 deletions

View File

@ -18,6 +18,7 @@ Optional Arguments
- `file_glob`: If set to true, the `file` argument can be a glob pattern (`asset_name` is ignored in this case) (Default: `false`)
- `overwrite`: If an asset with the same name already exists, overwrite it (Default: `false`).
- `promote`: If a prerelease already exists, promote it to a release (Default: `false`).
- `draft`: Sets the release as a draft instead of publishing it, allowing you to make any edits needed before releasing (Default: `false`).
- `prerelease`: Mark the release as a pre-release (Default: `false`).
- `make_latest`: Mark the release as the latest release for the repository (Default: `true`).
- `release_name`: Explicitly set a release name. (Defaults: implicitly same as `tag` via GitHub API).

View File

@ -24,6 +24,8 @@ inputs:
description: 'Promote a prerelease to release. Defaults to "false".'
file_glob:
description: 'If true the file can be a glob pattern, asset_name is ignored if this is true.'
draft:
description: 'Mark the release as a draft. Defaults to "false".'
prerelease:
description: 'Mark the release as a pre-release. Defaults to "false".'
make_latest:

42368
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@ -28,6 +28,7 @@ type UpdateReleaseParams = Endpoints[typeof updateRelease]['parameters']
async function get_release_by_tag(
tag: string,
draft: boolean,
prerelease: boolean,
make_latest: boolean,
release_name: string,
@ -68,6 +69,7 @@ async function get_release_by_tag(
return await octokit.request(createRelease, {
...repo(),
tag_name: tag,
draft: draft,
prerelease: prerelease,
make_latest: make_latest ? 'true' : 'false',
name: release_name,
@ -209,6 +211,7 @@ async function run(): Promise<void> {
const file_glob = core.getInput('file_glob') == 'true' ? true : false
const overwrite = core.getInput('overwrite') == 'true' ? true : false
const promote = core.getInput('promote') == 'true' ? true : false
const draft = core.getInput('draft') == 'true' ? true : false
const prerelease = core.getInput('prerelease') == 'true' ? true : false
const make_latest = core.getInput('make_latest') != 'false' ? true : false
const release_name = core.getInput('release_name')
@ -222,6 +225,7 @@ async function run(): Promise<void> {
const octokit = github.getOctokit(token)
const release = await get_release_by_tag(
tag,
draft,
prerelease,
make_latest,
release_name,