mirror of
https://github.com/softprops/action-gh-release.git
synced 2024-08-16 15:50:42 +03:00
add support for prereleases. fixes #17
This commit is contained in:
parent
bd839f3b8f
commit
a95bad53b2
@ -22,6 +22,8 @@ GitHub actions inputs don't inherently support lists of things and one might lik
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
```
|
||||
|
||||
* Add support for prerelease annotated GitHub releases with the new input field `with.prerelease: true`
|
||||
|
||||
---
|
||||
|
||||
## 0.1.1
|
||||
|
@ -25,6 +25,7 @@ describe("util", () => {
|
||||
input_body: undefined,
|
||||
input_body_path: undefined,
|
||||
input_draft: false,
|
||||
input_prerelease: false,
|
||||
input_files: [],
|
||||
input_name: undefined
|
||||
});
|
||||
|
@ -13,7 +13,10 @@ inputs:
|
||||
description: 'Gives the release a custom name. Defaults to tag name'
|
||||
required: false
|
||||
draft:
|
||||
description: 'Creates a draft release'
|
||||
description: 'Creates a draft release. Defaults to false'
|
||||
required: false
|
||||
prerelease:
|
||||
description: 'Identify the release as a prerelease. Defaults to false'
|
||||
required: false
|
||||
files:
|
||||
description: 'Newline-delimited list of path globs for asset files to upload'
|
||||
|
@ -100,6 +100,7 @@ exports.release = (config, releaser) => __awaiter(void 0, void 0, void 0, functi
|
||||
const name = config.input_name || tag;
|
||||
const body = config.input_body;
|
||||
const draft = config.input_draft;
|
||||
const prerelease = config.input_prerelease;
|
||||
console.log(`👩🏭 Creating new GitHub release for tag ${tag_name}...`);
|
||||
let release = yield releaser.createRelease({
|
||||
owner,
|
||||
@ -107,7 +108,8 @@ exports.release = (config, releaser) => __awaiter(void 0, void 0, void 0, functi
|
||||
tag_name,
|
||||
name,
|
||||
body,
|
||||
draft
|
||||
draft,
|
||||
prerelease
|
||||
});
|
||||
return release.data;
|
||||
}
|
||||
|
@ -24,7 +24,8 @@ exports.parseConfig = (env) => {
|
||||
input_body: env.INPUT_BODY,
|
||||
input_body_path: env.INPUT_BODY_PATH,
|
||||
input_files: exports.parseInputFiles(env.INPUT_FILES || ""),
|
||||
input_draft: env.INPUT_DRAFT === "true"
|
||||
input_draft: env.INPUT_DRAFT === "true",
|
||||
input_prerelease: env.INPUT_PRERELEASE == "true"
|
||||
};
|
||||
};
|
||||
exports.paths = (patterns) => {
|
||||
|
@ -31,6 +31,7 @@ export interface Releaser {
|
||||
name: string;
|
||||
body: string | undefined;
|
||||
draft: boolean | undefined;
|
||||
prerelease: boolean | undefined;
|
||||
}): Promise<{ data: Release }>;
|
||||
|
||||
allReleases(params: {
|
||||
@ -60,6 +61,7 @@ export class GitHubReleaser implements Releaser {
|
||||
name: string;
|
||||
body: string | undefined;
|
||||
draft: boolean | undefined;
|
||||
prerelease: boolean | undefined;
|
||||
}): Promise<{ data: Release }> {
|
||||
return this.github.repos.createRelease(params);
|
||||
}
|
||||
@ -138,6 +140,7 @@ export const release = async (
|
||||
const name = config.input_name || tag;
|
||||
const body = config.input_body;
|
||||
const draft = config.input_draft;
|
||||
const prerelease = config.input_prerelease;
|
||||
console.log(`👩🏭 Creating new GitHub release for tag ${tag_name}...`);
|
||||
let release = await releaser.createRelease({
|
||||
owner,
|
||||
@ -145,7 +148,8 @@ export const release = async (
|
||||
tag_name,
|
||||
name,
|
||||
body,
|
||||
draft
|
||||
draft,
|
||||
prerelease
|
||||
});
|
||||
return release.data;
|
||||
} catch (error) {
|
||||
|
@ -11,6 +11,7 @@ export interface Config {
|
||||
input_body_path?: string;
|
||||
input_files?: string[];
|
||||
input_draft?: boolean;
|
||||
input_prerelease?: boolean;
|
||||
}
|
||||
|
||||
type Env = { [key: string]: string | undefined };
|
||||
@ -35,7 +36,8 @@ export const parseConfig = (env: Env): Config => {
|
||||
input_body: env.INPUT_BODY,
|
||||
input_body_path: env.INPUT_BODY_PATH,
|
||||
input_files: parseInputFiles(env.INPUT_FILES || ""),
|
||||
input_draft: env.INPUT_DRAFT === "true"
|
||||
input_draft: env.INPUT_DRAFT === "true",
|
||||
input_prerelease: env.INPUT_PRERELEASE == "true"
|
||||
};
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user