Support $tag substitution in asset names

This commit is contained in:
Alex Jurkiewicz 2020-04-17 12:26:19 +10:00 committed by Sven-Hendrik Haase
parent c571424387
commit 223b39fc7a
No known key found for this signature in database
GPG Key ID: 39E4B877E62EB915
3 changed files with 4 additions and 4 deletions

View File

@ -9,8 +9,8 @@ You must provide:
- `repo_token`: Usually you'll want to set this to `${{ secrets.GITHUB_TOKEN }}` - `repo_token`: Usually you'll want to set this to `${{ secrets.GITHUB_TOKEN }}`
- `file`: A local file to be uploaded as the asset. - `file`: A local file to be uploaded as the asset.
- `asset_name`: The name the file gets as an asset on a release. - `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 }}` - `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. - `overwrite`: If an asset with the same name already exists, overwrite it.
Optional Arguments Optional Arguments

View File

@ -99,7 +99,7 @@ function run() {
} }
} }
else { 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); yield upload_to_release(release, file, asset_name, tag, overwrite, octokit, context);
} }
} }

View File

@ -93,7 +93,7 @@ async function run() {
} }
} }
else { 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); await upload_to_release(release, file, asset_name, tag, overwrite, octokit, context);
} }
} catch (error) { } catch (error) {