From 223b39fc7ad8e580e6de57075f26f411ea38764c Mon Sep 17 00:00:00 2001 From: Alex Jurkiewicz Date: Fri, 17 Apr 2020 12:26:19 +1000 Subject: [PATCH] Support $tag substitution in asset names --- README.md | 4 ++-- lib/main.js | 2 +- src/main.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ac94ad3..9ca5f90 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ You must provide: - `repo_token`: Usually you'll want to set this to `${{ secrets.GITHUB_TOKEN }}` - `file`: A local file to be uploaded as the asset. -- `asset_name`: The name the file gets as an asset on a release. -- `tag`: The tag to uploaded into. If you want the current event's tag, use `${{ github.ref }}` +- `asset_name`: The name the file gets as an asset on a release. Use `$tag` to include the tag name. +- `tag`: The tag to uploaded into. If you want the current event's tag, use `${{ github.ref }}` (the `refs/tags/` prefix will be automatically stripped). - `overwrite`: If an asset with the same name already exists, overwrite it. Optional Arguments diff --git a/lib/main.js b/lib/main.js index aee98b2..801c722 100644 --- a/lib/main.js +++ b/lib/main.js @@ -99,7 +99,7 @@ function run() { } } else { - const asset_name = core.getInput('asset_name', { required: true }); + const asset_name = core.getInput('asset_name', { required: true }).replace(/\$tag/g, tag); yield upload_to_release(release, file, asset_name, tag, overwrite, octokit, context); } } diff --git a/src/main.ts b/src/main.ts index 7fd1f45..9853860 100644 --- a/src/main.ts +++ b/src/main.ts @@ -93,7 +93,7 @@ async function run() { } } else { - const asset_name = core.getInput('asset_name', { required: true }); + const asset_name = core.getInput('asset_name', { required: true }).replace(/\$tag/g, tag); await upload_to_release(release, file, asset_name, tag, overwrite, octokit, context); } } catch (error) {