mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-05-10 18:44:19 +00:00
Merge pull request #19 from softprops/pre-releases
add support for prereleases
This commit is contained in:
commit
18d8be76a0
8 changed files with 22 additions and 6 deletions
|
@ -22,6 +22,8 @@ GitHub actions inputs don't inherently support lists of things and one might lik
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* Add support for prerelease annotated GitHub releases with the new input field `with.prerelease: true`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 0.1.1
|
## 0.1.1
|
||||||
|
|
|
@ -163,7 +163,8 @@ The following are optional as `step.with` keys
|
||||||
| `body` | String | Text communicating notable changes in this release |
|
| `body` | String | Text communicating notable changes in this release |
|
||||||
| `body_path` | String | Path to load text communicating notable changes in this release |
|
| `body_path` | String | Path to load text communicating notable changes in this release |
|
||||||
| `draft` | Boolean | Indicator of whether or not this release is a draft |
|
| `draft` | Boolean | Indicator of whether or not this release is a draft |
|
||||||
| `files` | String | Newline-delimited globs of paths to assets to upload for release |
|
| `prerelease`| Boolean | Indicator of whether or not is a prerelease |
|
||||||
|
| `files` | String | Newline-delimited globs of paths to assets to upload for release|
|
||||||
| `name` | String | Name of the release. defaults to tag name |
|
| `name` | String | Name of the release. defaults to tag name |
|
||||||
|
|
||||||
💡When providing a `body` and `body_path` at the same time, `body_path` will be attempted first, then falling back on `body` if the path can not be read from.
|
💡When providing a `body` and `body_path` at the same time, `body_path` will be attempted first, then falling back on `body` if the path can not be read from.
|
||||||
|
|
|
@ -25,6 +25,7 @@ describe("util", () => {
|
||||||
input_body: undefined,
|
input_body: undefined,
|
||||||
input_body_path: undefined,
|
input_body_path: undefined,
|
||||||
input_draft: false,
|
input_draft: false,
|
||||||
|
input_prerelease: false,
|
||||||
input_files: [],
|
input_files: [],
|
||||||
input_name: undefined
|
input_name: undefined
|
||||||
});
|
});
|
||||||
|
|
|
@ -13,7 +13,10 @@ inputs:
|
||||||
description: 'Gives the release a custom name. Defaults to tag name'
|
description: 'Gives the release a custom name. Defaults to tag name'
|
||||||
required: false
|
required: false
|
||||||
draft:
|
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
|
required: false
|
||||||
files:
|
files:
|
||||||
description: 'Newline-delimited list of path globs for asset files to upload'
|
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 name = config.input_name || tag;
|
||||||
const body = config.input_body;
|
const body = config.input_body;
|
||||||
const draft = config.input_draft;
|
const draft = config.input_draft;
|
||||||
|
const prerelease = config.input_prerelease;
|
||||||
console.log(`👩🏭 Creating new GitHub release for tag ${tag_name}...`);
|
console.log(`👩🏭 Creating new GitHub release for tag ${tag_name}...`);
|
||||||
let release = yield releaser.createRelease({
|
let release = yield releaser.createRelease({
|
||||||
owner,
|
owner,
|
||||||
|
@ -107,7 +108,8 @@ exports.release = (config, releaser) => __awaiter(void 0, void 0, void 0, functi
|
||||||
tag_name,
|
tag_name,
|
||||||
name,
|
name,
|
||||||
body,
|
body,
|
||||||
draft
|
draft,
|
||||||
|
prerelease
|
||||||
});
|
});
|
||||||
return release.data;
|
return release.data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,8 @@ exports.parseConfig = (env) => {
|
||||||
input_body: env.INPUT_BODY,
|
input_body: env.INPUT_BODY,
|
||||||
input_body_path: env.INPUT_BODY_PATH,
|
input_body_path: env.INPUT_BODY_PATH,
|
||||||
input_files: exports.parseInputFiles(env.INPUT_FILES || ""),
|
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) => {
|
exports.paths = (patterns) => {
|
||||||
|
|
|
@ -31,6 +31,7 @@ export interface Releaser {
|
||||||
name: string;
|
name: string;
|
||||||
body: string | undefined;
|
body: string | undefined;
|
||||||
draft: boolean | undefined;
|
draft: boolean | undefined;
|
||||||
|
prerelease: boolean | undefined;
|
||||||
}): Promise<{ data: Release }>;
|
}): Promise<{ data: Release }>;
|
||||||
|
|
||||||
allReleases(params: {
|
allReleases(params: {
|
||||||
|
@ -60,6 +61,7 @@ export class GitHubReleaser implements Releaser {
|
||||||
name: string;
|
name: string;
|
||||||
body: string | undefined;
|
body: string | undefined;
|
||||||
draft: boolean | undefined;
|
draft: boolean | undefined;
|
||||||
|
prerelease: boolean | undefined;
|
||||||
}): Promise<{ data: Release }> {
|
}): Promise<{ data: Release }> {
|
||||||
return this.github.repos.createRelease(params);
|
return this.github.repos.createRelease(params);
|
||||||
}
|
}
|
||||||
|
@ -138,6 +140,7 @@ export const release = async (
|
||||||
const name = config.input_name || tag;
|
const name = config.input_name || tag;
|
||||||
const body = config.input_body;
|
const body = config.input_body;
|
||||||
const draft = config.input_draft;
|
const draft = config.input_draft;
|
||||||
|
const prerelease = config.input_prerelease;
|
||||||
console.log(`👩🏭 Creating new GitHub release for tag ${tag_name}...`);
|
console.log(`👩🏭 Creating new GitHub release for tag ${tag_name}...`);
|
||||||
let release = await releaser.createRelease({
|
let release = await releaser.createRelease({
|
||||||
owner,
|
owner,
|
||||||
|
@ -145,7 +148,8 @@ export const release = async (
|
||||||
tag_name,
|
tag_name,
|
||||||
name,
|
name,
|
||||||
body,
|
body,
|
||||||
draft
|
draft,
|
||||||
|
prerelease
|
||||||
});
|
});
|
||||||
return release.data;
|
return release.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
@ -11,6 +11,7 @@ export interface Config {
|
||||||
input_body_path?: string;
|
input_body_path?: string;
|
||||||
input_files?: string[];
|
input_files?: string[];
|
||||||
input_draft?: boolean;
|
input_draft?: boolean;
|
||||||
|
input_prerelease?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
type Env = { [key: string]: string | undefined };
|
type Env = { [key: string]: string | undefined };
|
||||||
|
@ -35,7 +36,8 @@ export const parseConfig = (env: Env): Config => {
|
||||||
input_body: env.INPUT_BODY,
|
input_body: env.INPUT_BODY,
|
||||||
input_body_path: env.INPUT_BODY_PATH,
|
input_body_path: env.INPUT_BODY_PATH,
|
||||||
input_files: parseInputFiles(env.INPUT_FILES || ""),
|
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…
Add table
Add a link
Reference in a new issue