Add assets
action output (#185)
This commit is contained in:
parent
b260a9f8a6
commit
58fa4b7a88
@ -1,3 +1,5 @@
|
|||||||
|
- Add `asset` output as a JSON array containing information about the uploaded assets
|
||||||
|
|
||||||
## 0.1.14
|
## 0.1.14
|
||||||
|
|
||||||
- provides an new workflow input option `generate_release_notes` which when set to true will automatically generate release notes for you based on GitHub activity [#179](https://github.com/softprops/action-gh-release/pull/179). Please see the [GitHub docs for this feature](https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes) for more information
|
- provides an new workflow input option `generate_release_notes` which when set to true will automatically generate release notes for you based on GitHub activity [#179](https://github.com/softprops/action-gh-release/pull/179). Please see the [GitHub docs for this feature](https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes) for more information
|
||||||
|
@ -197,6 +197,9 @@ 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 |
|
| `upload_url` | String | URL for uploading assets to the release |
|
||||||
|
| `assets` | String | JSON array containing information about each uploaded asset, in the format given [here](https://docs.github.com/en/rest/reference/repos#upload-a-release-asset--code-samples) (minus the `uploader` field) |
|
||||||
|
|
||||||
|
As an example, you can use `${{ fromJSON(steps.<step-id>.outputs.assets)[0].browser_download_url }}` to get the download URL of the first asset.
|
||||||
|
|
||||||
#### environment variables
|
#### environment variables
|
||||||
|
|
||||||
|
@ -52,6 +52,8 @@ outputs:
|
|||||||
description: "Release ID"
|
description: "Release ID"
|
||||||
upload_url:
|
upload_url:
|
||||||
description: "URL for uploading assets to the release"
|
description: "URL for uploading assets to the release"
|
||||||
|
assets:
|
||||||
|
description: "JSON array containing information about each uploaded asset, in the format given [here](https://docs.github.com/en/rest/reference/repos#upload-a-release-asset--code-samples) (minus the `uploader` field)"
|
||||||
runs:
|
runs:
|
||||||
using: "node12"
|
using: "node12"
|
||||||
main: "dist/index.js"
|
main: "dist/index.js"
|
||||||
|
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
11
src/main.ts
11
src/main.ts
@ -65,20 +65,23 @@ async function run() {
|
|||||||
if (files.length == 0) {
|
if (files.length == 0) {
|
||||||
console.warn(`🤔 ${config.input_files} not include valid file.`);
|
console.warn(`🤔 ${config.input_files} not include valid file.`);
|
||||||
}
|
}
|
||||||
const currentAsserts = rel.assets;
|
const currentAssets = rel.assets;
|
||||||
await Promise.all(
|
const assets = await Promise.all(
|
||||||
files.map(async path => {
|
files.map(async path => {
|
||||||
await upload(
|
const json = await upload(
|
||||||
config,
|
config,
|
||||||
gh,
|
gh,
|
||||||
uploadUrl(rel.upload_url),
|
uploadUrl(rel.upload_url),
|
||||||
path,
|
path,
|
||||||
currentAsserts
|
currentAssets
|
||||||
);
|
);
|
||||||
|
delete json.uploader;
|
||||||
|
return json;
|
||||||
})
|
})
|
||||||
).catch(error => {
|
).catch(error => {
|
||||||
throw error;
|
throw error;
|
||||||
});
|
});
|
||||||
|
setOutput("assets", assets);
|
||||||
}
|
}
|
||||||
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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user