Merge branch 'master' into feature/GH-9_Add_release_ID_to_outputs

This commit is contained in:
Albertin Loic 2021-04-30 17:56:06 +02:00
commit cd4821a6a3
No known key found for this signature in database
GPG key ID: CEC427E796B6C023
8 changed files with 25 additions and 14 deletions

View file

@ -164,6 +164,7 @@ jobs:
body_path: ${{ github.workflow }}-CHANGELOG.txt body_path: ${{ github.workflow }}-CHANGELOG.txt
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: my_gh_org/my_gh_repo
``` ```
### 💅 Customizing ### 💅 Customizing
@ -193,6 +194,8 @@ The following outputs can be accessed via `${{ steps.<step-id>.outputs }}` from
|-------------|---------|-----------------------------------------------------------------| |-------------|---------|-----------------------------------------------------------------|
| `url` | String | Github.com URL for the release | | `url` | String | Github.com URL for the release |
| `id` | String | Release ID | | `id` | String | Release ID |
| `upload_url`| String | URL for uploading assets to the release |
#### environment variables #### environment variables
@ -201,6 +204,7 @@ The following are *required* as `step.env` keys
| Name | Description | | Name | Description |
|----------------|--------------------------------------| |----------------|--------------------------------------|
| `GITHUB_TOKEN` | GITHUB_TOKEN as provided by `secrets`| | `GITHUB_TOKEN` | GITHUB_TOKEN as provided by `secrets`|
| `GITHUB_REPOSITORY` | Name of a target repository in `<owner>/<repo>` format. defaults to the current repository|
> **⚠️ Note:** This action was previously implemented as a Docker container, limiting its use to GitHub Actions Linux virtual environments only. With recent releases, we now support cross platform usage. You'll need to remove the `docker://` prefix in these versions > **⚠️ Note:** This action was previously implemented as a Docker container, limiting its use to GitHub Actions Linux virtual environments only. With recent releases, we now support cross platform usage. You'll need to remove the `docker://` prefix in these versions

View file

@ -58,9 +58,9 @@ describe("util", () => {
}) })
); );
}); });
it("defaults to body when both body and body path are provided", () => { it("defaults to body path when both body and body path are provided", () => {
assert.equal( assert.equal(
"foo", "bar",
releaseBody({ releaseBody({
github_ref: "", github_ref: "",
github_repository: "", github_repository: "",

View file

@ -27,6 +27,9 @@ inputs:
fail_on_unmatched_files: fail_on_unmatched_files:
description: 'Fails if any of the `files` globs match nothing. Defaults to false' description: 'Fails if any of the `files` globs match nothing. Defaults to false'
required: false required: false
repository:
description: 'Repository to make releases against, in <owner>/<repo> format'
required: false
env: env:
'GITHUB_TOKEN': 'As provided by Github Actions' 'GITHUB_TOKEN': 'As provided by Github Actions'
outputs: outputs:
@ -34,9 +37,11 @@ outputs:
description: 'URL to the Release HTML Page' description: 'URL to the Release HTML Page'
id: id:
description: 'Release ID' description: 'Release ID'
upload_url:
description: 'URL for uploading assets to the release'
runs: runs:
using: 'node12' using: 'node12'
main: 'dist/index.js' main: 'dist/index.js'
branding: branding:
color: 'green' color: 'green'
icon: 'package' icon: 'package'

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

12
package-lock.json generated
View file

@ -5,9 +5,9 @@
"requires": true, "requires": true,
"dependencies": { "dependencies": {
"@actions/core": { "@actions/core": {
"version": "1.2.0", "version": "1.2.6",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.0.tgz", "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz",
"integrity": "sha512-ZKdyhlSlyz38S6YFfPnyNgCDZuAF2T0Qv5eHflNWytPS8Qjvz39bZFMry9Bb/dpSnqWcNeav5yM2CTYpJeY+Dw==" "integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA=="
}, },
"@actions/github": { "@actions/github": {
"version": "2.0.0", "version": "2.0.0",
@ -3708,9 +3708,9 @@
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ=="
}, },
"node-fetch": { "node-fetch": {
"version": "2.6.0", "version": "2.6.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
"integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==" "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
}, },
"node-int64": { "node-int64": {
"version": "0.4.0", "version": "0.4.0",

View file

@ -20,7 +20,7 @@
"author": "softprops", "author": "softprops",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^1.2.0", "@actions/core": "^1.2.6",
"@actions/github": "^2.0.0", "@actions/github": "^2.0.0",
"@octokit/plugin-retry": "^3.0.2", "@octokit/plugin-retry": "^3.0.2",
"@octokit/plugin-throttling": "^3.2.1", "@octokit/plugin-throttling": "^3.2.1",

View file

@ -56,6 +56,7 @@ async function run() {
console.log(`🎉 Release ready at ${rel.html_url}`); console.log(`🎉 Release ready at ${rel.html_url}`);
setOutput("url", rel.html_url); setOutput("url", rel.html_url);
setOutput("id", rel.id.toString()); setOutput("id", rel.id.toString());
setOutput("upload_url", rel.upload_url);
} catch (error) { } catch (error) {
setFailed(error.message); setFailed(error.message);
} }

View file

@ -8,6 +8,7 @@ export interface Config {
// user provided // user provided
input_name?: string; input_name?: string;
input_tag_name?: string; input_tag_name?: string;
input_repository?: string;
input_body?: string; input_body?: string;
input_body_path?: string; input_body_path?: string;
input_files?: string[]; input_files?: string[];
@ -18,9 +19,9 @@ export interface Config {
export const releaseBody = (config: Config): string | undefined => { export const releaseBody = (config: Config): string | undefined => {
return ( return (
config.input_body ||
(config.input_body_path && (config.input_body_path &&
readFileSync(config.input_body_path).toString("utf8")) readFileSync(config.input_body_path).toString("utf8")) ||
config.input_body
); );
}; };
@ -41,7 +42,7 @@ export const parseConfig = (env: Env): Config => {
return { return {
github_token: env.GITHUB_TOKEN || "", github_token: env.GITHUB_TOKEN || "",
github_ref: env.GITHUB_REF || "", github_ref: env.GITHUB_REF || "",
github_repository: env.GITHUB_REPOSITORY || "", github_repository: env.INPUT_REPOSITORY || env.GITHUB_REPOSITORY || "",
input_name: env.INPUT_NAME, input_name: env.INPUT_NAME,
input_tag_name: env.INPUT_TAG_NAME, input_tag_name: env.INPUT_TAG_NAME,
input_body: env.INPUT_BODY, input_body: env.INPUT_BODY,