Skip to content

Commit

Permalink
feat: Add tagOverwrite option
Browse files Browse the repository at this point in the history
  • Loading branch information
peaceiris committed Jan 13, 2020
1 parent 0f98ab4 commit ee5987d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ inputs:
tagMessage:
description: 'Set tag message'
required: false
tagOverwrite:
description: 'Enable overwriting tag'
required: false
default: false
15 changes: 11 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,20 @@ fi

if [[ -n "${INPUT_TAGNAME}" ]]; then
print_info "Tag name: ${INPUT_TAGNAME}"
print_info "Tag message: ${INPUT_TAGMESSAGE}"
print_info "Tag overwrite: ${INPUT_TAGOVERWRITE}"
if [[ -n "${INPUT_TAGMESSAGE}" ]]; then
print_info "Tag message: ${INPUT_TAGMESSAGE}"
git tag "${INPUT_TAGNAME}" -m "${INPUT_TAGMESSAGE}"
GIT_TAG_MESSAGE="${INPUT_TAGMESSAGE}"
else
git tag "${INPUT_TAGNAME}"
GIT_TAG_MESSAGE="Deployment ${INPUT_TAGNAME}"
fi
git push origin "${INPUT_TAGNAME}"
if [[ "${INPUT_TAGOVERWRITE}" == "true" ]]; then
GIT_TAG_OPTION="--force"
else
GIT_TAG_OPTION=""
fi
git tag "${GIT_TAG_OPTION}" -a "${INPUT_TAGNAME}" -m "${GIT_TAG_MESSAGE}"
git push "${GIT_TAG_OPTION}" origin "${INPUT_TAGNAME}"
fi

print_info "${GITHUB_SHA} was successfully deployed"

0 comments on commit ee5987d

Please sign in to comment.