From 114ab683ffc5c2f0e3d4ef4fa812787318eb1993 Mon Sep 17 00:00:00 2001 From: npldevfr Date: Mon, 29 Jan 2024 17:23:53 +0100 Subject: [PATCH] fix: release script --- scripts/release.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/release.sh b/scripts/release.sh index 1f5ef63..932b13d 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -1,5 +1,11 @@ #!/bin/bash +# Check if a version number is provided as an argument +if [ $# -eq 0 ]; then + echo "Error: Please provide a version number as an argument." + exit 1 +fi + # Get the current version from your composer.json currentVersion=$(jq -r .version composer.json) @@ -20,8 +26,12 @@ incrementVersion() { fi } -# Calculate the new version -newVersion=$(incrementVersion "$currentVersion") +# Use the provided version or increment the current version +if [[ $1 =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + newVersion=$1 +else + newVersion=$(incrementVersion "$currentVersion") +fi # Display the new version echo "Creating a new release for $(jq -r .name composer.json)..."