diff --git a/action.sh b/action.sh index c38c589..fd547f3 100755 --- a/action.sh +++ b/action.sh @@ -2,8 +2,15 @@ apt update apt install jq -y git config --global user.email "cloud+git+runner@thorup.us" git config --global user.name "Git runner" -CURRENT_VERSION=$(jq -r .version package.json) +CURRENT_VERSION=$INPUT_PREFIX$(jq -r .version package.json) echo $CURRENT_VERSION + +if [[ $INPUT_FORCE_OVERRIDE == true ]]; +then + git tag -d $CURRENT_VERSION || true + git push --delete origin $CURRENT_VERION || true +fi + PREVIOUS_VERSIONS=$(git tag -l) echo $PREVIOUS_VERSIONS diff --git a/action.yaml b/action.yaml index ac16491..253a0e6 100644 --- a/action.yaml +++ b/action.yaml @@ -1,6 +1,11 @@ name: version-tag -description: "Creates a version tag when the 'version' value in 'package.json' has changed and a tag with the version number does not already exist." +description: "Creates a version tag when the 'version' value in 'package.json' has changed and a tag with the version number (including optional prefix) does not already exist." author: "Bryce Thorup" +inputs: + prefix: + description: Prefix to be added to version tag + force_override: + description: Allows an existing tag to be overridden if set to "true" runs: using: "composite" steps: