Add assets
action output (#185)
This commit is contained in:
parent
b260a9f8a6
commit
58fa4b7a88
5 changed files with 15 additions and 5 deletions
|
@ -1,3 +1,5 @@
|
|||
- Add `asset` output as a JSON array containing information about the uploaded assets
|
||||
|
||||
## 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
|
||||
|
|
|
@ -197,6 +197,9 @@ The following outputs can be accessed via `${{ steps.<step-id>.outputs }}` from
|
|||
| `url` | String | Github.com URL for the release |
|
||||
| `id` | String | Release ID |
|
||||
| `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
|
||||
|
||||
|
|
|
@ -52,6 +52,8 @@ outputs:
|
|||
description: "Release ID"
|
||||
upload_url:
|
||||
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:
|
||||
using: "node12"
|
||||
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) {
|
||||
console.warn(`🤔 ${config.input_files} not include valid file.`);
|
||||
}
|
||||
const currentAsserts = rel.assets;
|
||||
await Promise.all(
|
||||
const currentAssets = rel.assets;
|
||||
const assets = await Promise.all(
|
||||
files.map(async path => {
|
||||
await upload(
|
||||
const json = await upload(
|
||||
config,
|
||||
gh,
|
||||
uploadUrl(rel.upload_url),
|
||||
path,
|
||||
currentAsserts
|
||||
currentAssets
|
||||
);
|
||||
delete json.uploader;
|
||||
return json;
|
||||
})
|
||||
).catch(error => {
|
||||
throw error;
|
||||
});
|
||||
setOutput("assets", assets);
|
||||
}
|
||||
console.log(`🎉 Release ready at ${rel.html_url}`);
|
||||
setOutput("url", rel.html_url);
|
||||
|
|
Loading…
Reference in a new issue