Skip to content

Commit

Permalink
Merge pull request #2 from anothrNick/master
Browse files Browse the repository at this point in the history
Update set-output to use GITHUB_OUTPUT file (anothrNick#206)
  • Loading branch information
lobner committed Nov 12, 2022
2 parents 68e1ce2 + be61601 commit 4feafc7
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions entrypoint.sh
Expand Up @@ -49,6 +49,10 @@ then
set -x
fi

setOutput() {
echo "${1}=${2}" >> "${GITHUB_OUTPUT}"
}

current_branch=$(git rev-parse --abbrev-ref HEAD)

pre_release="$prerelease"
Expand Down Expand Up @@ -116,8 +120,8 @@ commit=$(git rev-parse HEAD)
if [ "$tag_commit" == "$commit" ]
then
echo "No new commits since previous tag. Skipping..."
echo "::set-output name=new_tag::$tag"
echo "::set-output name=tag::$tag"
setOutput "new_tag" "$tag"
setOutput "tag" "$tag"
exit 0
fi

Expand All @@ -131,15 +135,15 @@ case "$log" in
*$patch_string_token* ) new=$(semver -i patch "$tag"); part="patch";;
*$none_string_token* )
echo "Default bump was set to none. Skipping..."
echo "::set-output name=new_tag::$tag"
echo "::set-output name=tag::$tag"
setOutput "new_tag" "$tag"
setOutput "tag" "$tag"
exit 0;;
* )
if [ "$default_semvar_bump" == "none" ]
then
echo "Default bump was set to none. Skipping..."
echo "::set-output name=new_tag::$tag"
echo "::set-output name=tag::$tag"
setOutput "new_tag" "$tag"
setOutput "tag" "$tag"
exit 0
else
new=$(semver -i "${default_semvar_bump}" "$tag")
Expand Down Expand Up @@ -185,10 +189,10 @@ then
fi

# set outputs
echo "::set-output name=new_tag::$new"
echo "::set-output name=part::$part"
echo "::set-output name=tag::$new" # this needs to go in v2 is breaking change
echo "::set-output name=old_tag::$tag"
setOutput "new_tag" "$new"
setOutput "part" "$part"
setOutput "tag" "$new" # this needs to go in v2 is breaking change
setOutput "old_tag" "$tag"

# dry run exit without real changes
if $dryrun
Expand Down

0 comments on commit 4feafc7

Please sign in to comment.