Skip to content

Commit

Permalink
Set computed-prefix and version outputs
Browse files Browse the repository at this point in the history
I've found these to be useful while composing this action with others.
  • Loading branch information
sunshowers authored and taiki-e committed Feb 17, 2022
1 parent 5d67938 commit 22abf80
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ Currently, changelog format and supported tag names have the following rule:
| branch | false | Reject releases from commits not contained in branches that match the specified pattern (regular expression) | String | |
| prefix | false | An optional pattern that matches a prefix for the release tag, before the version number (see [action.yml](action.yml) for more) | String | |

### Outputs

| Name | Description |
|-----------------|----------------------------------------------------------------------------------------------------------------|
| computed-prefix | The computed prefix, including '-' and 'v'. |
| version | The version number extracted from the tag. The tag name is a concatenation of `computed-prefix` and `version`.-|

### Example workflow: Basic usage

```yaml
Expand Down
8 changes: 8 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ inputs:
required: false
default: ''

outputs:
computed-prefix:
description: >
The computed prefix, including '-' and 'v' if found.
version:
description:
The version number extracted from the tag. The tag name is a concatenation of computed-prefix
and version.
runs:
using: node16
main: main.js
5 changes: 5 additions & 0 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,8 @@ fi

# https://cli.github.com/manual/gh_release_create
gh release create ${draft_option:-} "${tag}" ${prerelease:-} --title "${title}" --notes "${notes:-}"

# set (computed) prefix and version outputs for future step use
computed_prefix=${tag%"$version"}
echo "::set-output name=computed-prefix::${computed_prefix}"
echo "::set-output name=version::${version}"

0 comments on commit 22abf80

Please sign in to comment.