summaryrefslogtreecommitdiffstats
path: root/release.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-08-15 12:32:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-08-15 12:32:15 +0000
commitfd268d35cbddff04fc0b27a8af2c97185c8a97ba (patch)
tree9c180a60597c0c8cb9eebc7c1c6841787c856f42 /release.sh
parentReleasing debian version 2.1~rc0-1. (diff)
downloadnvme-cli-fd268d35cbddff04fc0b27a8af2c97185c8a97ba.tar.xz
nvme-cli-fd268d35cbddff04fc0b27a8af2c97185c8a97ba.zip
Merging upstream version 2.1.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'release.sh')
-rwxr-xr-xrelease.sh61
1 files changed, 34 insertions, 27 deletions
diff --git a/release.sh b/release.sh
index 2199eac..320da46 100755
--- a/release.sh
+++ b/release.sh
@@ -1,39 +1,50 @@
#!/bin/bash
usage() {
- echo "release.sh: VERSION"
+ echo "Usage: release.sh [-d] VERSION"
echo ""
echo "The script does all necessary steps to create a new release."
echo ""
+ echo " -d: no documentation update"
+ echo ""
echo "Note: The version number needs to be exactly"
- echo " '^v[\d]+.[\d]+(-rc[0-9]+)?$'"
+ echo " '^v[\d]+.[\d]+(.[\d\]+(-rc[0-9]+)?$'"
echo ""
echo "example:"
- echo " release.sh v2.1-rc0 # v2.1 release candidate 0 -> sets the project "
- echo " # version to '1.1' and sets the tag"
- echo " release.sh v2.1-rc1 # v2.1 release canditate 1 -> only sets the tag"
- echo " release.sh v2.1 # v2.1 release -> sets the final tag"
+ echo " release.sh v2.1-rc0 # v2.1 release candidate 0"
+ echo " release.sh v2.1 # v2.1 release"
}
-VERSION=$1
+build_doc=true
+
+while getopts "d" o; do
+ case "${o}" in
+ d)
+ build_doc=false
+ ;;
+ *)
+ usage
+ ;;
+ esac
+done
+shift $((OPTIND-1))
+
+VERSION=${1:-}
if [ -z "$VERSION" ] ; then
usage
exit 1
fi
-new_ver=""
-rc=""
+ver=""
-re='^v([0-9]+\.[0-9]+)(-rc[0-9]+)?$'
+re='^v([0-9]+\.[0-9]+(\.[0-9]+)?)(-rc[0-9]+)?$'
if [[ "$VERSION" =~ $re ]]; then
echo "Valid version $VERSION string"
- new_ver=${BASH_REMATCH[1]}
- rc=${BASH_REMATCH[2]}
+ # remove the leading 'v'
+ ver=${VERSION#v}
else
echo "Invalid version string $VERSION"
- echo ""
- usage
exit 1
fi
@@ -58,22 +69,18 @@ else
exit 1
fi
-./$doc_dir/update-docs.sh
-git add $doc_dir
-git commit -s -m "Regenerate all documentation" \
- -m "Regenerate documentation for $VERSION release"
-
# update meson.build
-old_ver=$(sed -n "0,/[ \t]\+version: /s/[ \t]\+version: '\([0-9]\+.[0-9]\+\)',$/\1/p" meson.build)
-if [ "$old_ver" != "$new_ver" ]; then
- # Only update project version once, that is either
- # - for the first RC phase or
- # - for the release when there was no RC
- sed -i -e "0,/[ \t]version: /s/\([ \t]version: \).*/\1\'$new_ver\',/" meson.build
- git add meson.build
+sed -i -e "0,/[ \t]version: /s/\([ \t]version: \).*/\1\'$ver\',/" meson.build
+git add meson.build
+git commit -s -m "build: Update version to $VERSION"
+
+if [ "$build_doc" = true ]; then
+ # update documentation
+ ./$doc_dir/update-docs.sh
+ git add $doc_dir
+ git commit -s -m "doc: Regenerate all docs for $VERSION"
fi
-git commit -s -m "Release $VERSION"
git tag -s -m "Release $VERSION" "$VERSION"
git push --dry-run origin "$VERSION"^{}:master tag "$VERSION"