feat(dedup): added support for four digit versions
Some checks failed
Docker Image CI / build (push) Waiting to run
release / release (push) Waiting to run
release / release-check (push) Waiting to run
reviewdog / runner / shellcheck (push) Waiting to run
reviewdog / runner / hadolint (push) Waiting to run
Test / test (push) Waiting to run
Test / needless_prefix (push) Waiting to run
Test / not_semver (push) Waiting to run
Test / quoted_version (push) Waiting to run
Test / tagged_version (push) Waiting to run
depup / reviewdog (push) Has been cancelled
depup / redpen (push) Has been cancelled
depup / themis (push) Has been cancelled

This commit is contained in:
2024-06-24 19:08:21 +02:00
parent 6e3eed16f3
commit 17c1df99e4

View File

@@ -11,7 +11,7 @@ VERSION_NAME="${INPUT_VERSION_NAME:-REVIEWDOG_VERSION}"
# Get current version. # Get current version.
# NOTE: Go to https://regex101.com/r/t1JcmL/13 To see the current regex in action. # NOTE: Go to https://regex101.com/r/t1JcmL/13 To see the current regex in action.
CURRENT_VERSION=$(grep -oP "${VERSION_NAME}(?:\s*=\s*|:?\s*)[\"|\']?v?\K\d+\.\d+\.\d+\.\d+\.?(-[^\'\"\s]*)?" "${FILE}" | head -n1) CURRENT_VERSION=$(grep -oP "${VERSION_NAME}(?:\s*=\s*|:?\s*)[\"|\']?v?\K\d+\.\d+(\.\d+)(\.\d+)?(-[^\'\"\s]*)?" "${FILE}" | head -n1)
if [ -z "${CURRENT_VERSION}" ]; then if [ -z "${CURRENT_VERSION}" ]; then
echo "cannot parse ${VERSION_NAME}" echo "cannot parse ${VERSION_NAME}"
exit 1 exit 1
@@ -71,6 +71,6 @@ if [ "${CURRENT_VERSION}" = "${LATEST_VERSION}" ]; then
fi fi
echo "Updating ${VERSION_NAME} to ${LATEST_VERSION} in ${FILE}" echo "Updating ${VERSION_NAME} to ${LATEST_VERSION} in ${FILE}"
perl -i -pe "s/${VERSION_NAME}(?:\s*=\s*|:?\s*)[\"|\']?v?\K\d+\.\d+\.\d+\.\d+\.?(-[^\'\"\s]*)?/${LATEST_VERSION}/g" "${FILE}" perl -i -pe "s/${VERSION_NAME}(?:\s*=\s*|:?\s*)[\"|\']?v?\K\d+\.\d+(\.\d+)(\.\d+)?(-[^\'\"\s]*)?/${LATEST_VERSION}/g" "${FILE}"
echo "Updated. Commit and create Pull-Request as you need." echo "Updated. Commit and create Pull-Request as you need."