Fixing get version same commit
This commit is contained in:
16
action.yml
16
action.yml
@@ -19,10 +19,19 @@ runs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "${SEMVER_UPDATE}" ]]; then
|
if [[ -n "${SEMVER_UPDATE}" ]]; then
|
||||||
git fetch --tags --force
|
log_info "Requested $(yellow)${SEMVER_UPDATE}$(reset_color) update"
|
||||||
|
git fetch --tags --force &>/dev/null
|
||||||
|
|
||||||
last_version="$(git describe --tags --abbrev=0 --match "v*" 2> /dev/null || echo "")"
|
last_version="$(git describe --tags --abbrev=0 --match "v*" 2> /dev/null || echo "")"
|
||||||
if [[ -z "$last_version" ]]; then
|
|
||||||
|
if git tag --points-at HEAD | grep -q "^${last_version}"; then
|
||||||
|
log_info "A tag already exists on the current commit, using it"
|
||||||
|
NEW_VERSION="${last_version:1}"
|
||||||
|
else
|
||||||
|
git fetch --tags --force --unshallow || echo "No fetch needed"
|
||||||
|
last_version="$(git describe --tags --abbrev=0 --match "v*" 2> /dev/null || echo "")"
|
||||||
|
|
||||||
|
if [[ -z "${last_version}" ]]; then
|
||||||
last_version="v0.0.0"
|
last_version="v0.0.0"
|
||||||
fi
|
fi
|
||||||
last_version="${last_version:1}"
|
last_version="${last_version:1}"
|
||||||
@@ -40,8 +49,7 @@ runs:
|
|||||||
"Patch"*) NEW_VERSION="$major.$minor.$((patch + 1))"
|
"Patch"*) NEW_VERSION="$major.$minor.$((patch + 1))"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
fi;
|
||||||
log_info "Requested ${SEMVER_UPDATE} update"
|
|
||||||
|
|
||||||
NEW_VERSION="v${NEW_VERSION}"
|
NEW_VERSION="v${NEW_VERSION}"
|
||||||
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
|
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user