Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
2956b0de81 | |||
0aec73c6d6 | |||
ce95482067 | |||
2861dc8673 | |||
dd98a235fd |
@ -1,3 +1,7 @@
|
||||
## 0.1.9
|
||||
|
||||
- add support for linking release to GitHub discussion [#136](https://github.com/softprops/action-gh-release/pull/136)
|
||||
|
||||
## 0.1.8
|
||||
|
||||
- address recent warnings in assert upload api as well as introduce asset upload overrides, allowing for multiple runs for the same release with the same named asserts [#134](https://github.com/softprops/action-gh-release/pull/134)
|
||||
|
29
README.md
29
README.md
@ -152,6 +152,9 @@ jobs:
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
body_path: ${{ github.workspace }}-CHANGELOG.txt
|
||||
# note you'll typically need to create a personal access token
|
||||
# with permissions to create releases in the other repo
|
||||
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
|
||||
env:
|
||||
GITHUB_REPOSITORY: my_gh_org/my_gh_repo
|
||||
```
|
||||
@ -162,18 +165,20 @@ jobs:
|
||||
|
||||
The following are optional as `step.with` keys
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------------------------- | ------- | --------------------------------------------------------------------------------------------------- |
|
||||
| `body` | String | 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 |
|
||||
| `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 |
|
||||
| `tag_name` | String | Name of a tag. defaults to `github.ref` |
|
||||
| `fail_on_unmatched_files` | Boolean | Indicator of whether to fail if any of the `files` globs match nothing |
|
||||
| `target_commitish` | String | Commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. |
|
||||
| `token` | String | Secret GitHub Personal Access Token. Defaults to `${{ github.token }}` |
|
||||
| Name | Type | Description |
|
||||
| -------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `body` | String | 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 |
|
||||
| `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 |
|
||||
| `tag_name` | String | Name of a tag. defaults to `github.ref` |
|
||||
| `fail_on_unmatched_files` | Boolean | Indicator of whether to fail if any of the `files` globs match nothing |
|
||||
| `repository` | String | Name of a target repository in `<owner>/<repo>` format. Defaults to GITHUB_REPOSITORY env variable |
|
||||
| `target_commitish` | String | Commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. |
|
||||
| `token` | String | Secret GitHub Personal Access Token. Defaults to `${{ github.token }}` |
|
||||
| `discussion_category_name` | String | If specified, a discussion of the specified category is created and linked to the release. The value must be a category that already exists in the repository. For more information, see ["Managing categories for discussions in your repository."](https://docs.github.com/en/discussions/managing-discussions-for-your-community/managing-categories-for-discussions-in-your-repository) |
|
||||
|
||||
💡 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.
|
||||
|
@ -49,7 +49,8 @@ describe("util", () => {
|
||||
input_files: [],
|
||||
input_name: undefined,
|
||||
input_tag_name: undefined,
|
||||
input_target_commitish: undefined
|
||||
input_target_commitish: undefined,
|
||||
input_discussion_category_name: undefined
|
||||
})
|
||||
);
|
||||
});
|
||||
@ -67,7 +68,8 @@ describe("util", () => {
|
||||
input_files: [],
|
||||
input_name: undefined,
|
||||
input_tag_name: undefined,
|
||||
input_target_commitish: undefined
|
||||
input_target_commitish: undefined,
|
||||
input_discussion_category_name: undefined
|
||||
})
|
||||
);
|
||||
});
|
||||
@ -85,7 +87,8 @@ describe("util", () => {
|
||||
input_files: [],
|
||||
input_name: undefined,
|
||||
input_tag_name: undefined,
|
||||
input_target_commitish: undefined
|
||||
input_target_commitish: undefined,
|
||||
input_discussion_category_name: undefined
|
||||
})
|
||||
);
|
||||
});
|
||||
@ -104,7 +107,8 @@ describe("util", () => {
|
||||
input_name: undefined,
|
||||
input_tag_name: undefined,
|
||||
input_fail_on_unmatched_files: false,
|
||||
input_target_commitish: undefined
|
||||
input_target_commitish: undefined,
|
||||
input_discussion_category_name: undefined
|
||||
});
|
||||
});
|
||||
|
||||
@ -125,7 +129,30 @@ describe("util", () => {
|
||||
input_name: undefined,
|
||||
input_tag_name: undefined,
|
||||
input_fail_on_unmatched_files: false,
|
||||
input_target_commitish: "affa18ef97bc9db20076945705aba8c516139abd"
|
||||
input_target_commitish: "affa18ef97bc9db20076945705aba8c516139abd",
|
||||
input_discussion_category_name: undefined
|
||||
}
|
||||
);
|
||||
});
|
||||
it("supports discussion category names", () => {
|
||||
assert.deepStrictEqual(
|
||||
parseConfig({
|
||||
INPUT_DISCUSSION_CATEGORY_NAME: "releases"
|
||||
}),
|
||||
{
|
||||
github_ref: "",
|
||||
github_repository: "",
|
||||
github_token: "",
|
||||
input_body: undefined,
|
||||
input_body_path: undefined,
|
||||
input_draft: undefined,
|
||||
input_prerelease: undefined,
|
||||
input_files: [],
|
||||
input_name: undefined,
|
||||
input_tag_name: undefined,
|
||||
input_fail_on_unmatched_files: false,
|
||||
input_target_commitish: undefined,
|
||||
input_discussion_category_name: "releases"
|
||||
}
|
||||
);
|
||||
});
|
||||
@ -149,7 +176,8 @@ describe("util", () => {
|
||||
input_name: undefined,
|
||||
input_tag_name: undefined,
|
||||
input_fail_on_unmatched_files: false,
|
||||
input_target_commitish: undefined
|
||||
input_target_commitish: undefined,
|
||||
input_discussion_category_name: undefined
|
||||
}
|
||||
);
|
||||
});
|
||||
@ -172,7 +200,8 @@ describe("util", () => {
|
||||
input_name: undefined,
|
||||
input_tag_name: undefined,
|
||||
input_fail_on_unmatched_files: false,
|
||||
input_target_commitish: undefined
|
||||
input_target_commitish: undefined,
|
||||
input_discussion_category_name: undefined
|
||||
}
|
||||
);
|
||||
});
|
||||
@ -194,7 +223,8 @@ describe("util", () => {
|
||||
input_name: undefined,
|
||||
input_tag_name: undefined,
|
||||
input_fail_on_unmatched_files: false,
|
||||
input_target_commitish: undefined
|
||||
input_target_commitish: undefined,
|
||||
input_discussion_category_name: undefined
|
||||
}
|
||||
);
|
||||
});
|
||||
|
@ -37,13 +37,16 @@ inputs:
|
||||
target_commitish:
|
||||
description: "Commitish value that determines where the Git tag is created from. Can be any branch or commit SHA."
|
||||
required: false
|
||||
discussion_category_name:
|
||||
description: "If specified, a discussion of the specified category is created and linked to the release. The value must be a category that already exists in the repository. If there is already a discussion linked to the release, this parameter is ignored."
|
||||
required: false
|
||||
env:
|
||||
"GITHUB_TOKEN": "As provided by Github Actions"
|
||||
outputs:
|
||||
url:
|
||||
description: 'URL to the Release HTML Page'
|
||||
description: "URL to the Release HTML Page"
|
||||
id:
|
||||
description: 'Release ID'
|
||||
description: "Release ID"
|
||||
upload_url:
|
||||
description: "URL for uploading assets to the release"
|
||||
runs:
|
||||
|
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "action-gh-release",
|
||||
"version": "0.1.8",
|
||||
"version": "0.1.9",
|
||||
"private": true,
|
||||
"description": "GitHub Action for creating GitHub Releases",
|
||||
"main": "lib/main.js",
|
||||
|
@ -43,6 +43,7 @@ export interface Releaser {
|
||||
draft: boolean | undefined;
|
||||
prerelease: boolean | undefined;
|
||||
target_commitish: string | undefined;
|
||||
discussion_category_name: string | undefined;
|
||||
}): Promise<{ data: Release }>;
|
||||
|
||||
updateRelease(params: {
|
||||
@ -55,6 +56,7 @@ export interface Releaser {
|
||||
body: string | undefined;
|
||||
draft: boolean | undefined;
|
||||
prerelease: boolean | undefined;
|
||||
discussion_category_name: string | undefined;
|
||||
}): Promise<{ data: Release }>;
|
||||
|
||||
allReleases(params: {
|
||||
@ -86,6 +88,7 @@ export class GitHubReleaser implements Releaser {
|
||||
draft: boolean | undefined;
|
||||
prerelease: boolean | undefined;
|
||||
target_commitish: string | undefined;
|
||||
discussion_category_name: string | undefined;
|
||||
}): Promise<{ data: Release }> {
|
||||
return this.github.rest.repos.createRelease(params);
|
||||
}
|
||||
@ -100,6 +103,7 @@ export class GitHubReleaser implements Releaser {
|
||||
body: string | undefined;
|
||||
draft: boolean | undefined;
|
||||
prerelease: boolean | undefined;
|
||||
discussion_category_name: string | undefined;
|
||||
}): Promise<{ data: Release }> {
|
||||
return this.github.rest.repos.updateRelease(params);
|
||||
}
|
||||
@ -185,6 +189,8 @@ export const release = async (
|
||||
(isTag(config.github_ref)
|
||||
? config.github_ref.replace("refs/tags/", "")
|
||||
: "");
|
||||
|
||||
const discussion_category_name = config.input_discussion_category_name;
|
||||
try {
|
||||
// you can't get a an existing draft by tag
|
||||
// so we must find one in the list of all releases
|
||||
@ -246,7 +252,8 @@ export const release = async (
|
||||
name,
|
||||
body,
|
||||
draft,
|
||||
prerelease
|
||||
prerelease,
|
||||
discussion_category_name
|
||||
});
|
||||
return release.data;
|
||||
} catch (error) {
|
||||
@ -273,7 +280,8 @@ export const release = async (
|
||||
body,
|
||||
draft,
|
||||
prerelease,
|
||||
target_commitish
|
||||
target_commitish,
|
||||
discussion_category_name
|
||||
});
|
||||
return release.data;
|
||||
} catch (error) {
|
||||
|
@ -16,6 +16,7 @@ export interface Config {
|
||||
input_prerelease?: boolean;
|
||||
input_fail_on_unmatched_files?: boolean;
|
||||
input_target_commitish?: string;
|
||||
input_discussion_category_name?: string;
|
||||
}
|
||||
|
||||
export const uploadUrl = (url: string): string => {
|
||||
@ -62,7 +63,8 @@ export const parseConfig = (env: Env): Config => {
|
||||
? env.INPUT_PRERELEASE == "true"
|
||||
: undefined,
|
||||
input_fail_on_unmatched_files: env.INPUT_FAIL_ON_UNMATCHED_FILES == "true",
|
||||
input_target_commitish: env.INPUT_TARGET_COMMITISH
|
||||
input_target_commitish: env.INPUT_TARGET_COMMITISH,
|
||||
input_discussion_category_name: env.INPUT_DISCUSSION_CATEGORY_NAME
|
||||
};
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user