summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham@ideasonboard.com>2022-10-01 00:28:26 +0100
committerKieran Bingham <kieran.bingham@ideasonboard.com>2022-10-13 12:40:24 +0100
commitfc46d091231e22f47e2056fb854ddf4a999d606a (patch)
treea5422b1eeb6d14b4b58a18423a04d0d7a754d3ef /utils
parent1bd14fc8954425ac310d24876c6257f0b80c4880 (diff)
utils: Provide a release script
Support making releases of libcamera by introducing a helper script which will facilitate the increment of any release version, along with generating an associated tag. Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'utils')
-rwxr-xr-xutils/release.sh46
1 files changed, 46 insertions, 0 deletions
diff --git a/utils/release.sh b/utils/release.sh
new file mode 100755
index 00000000..8cc85859
--- /dev/null
+++ b/utils/release.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Prepare a project release
+
+set -e
+
+# Abort if we are not within the project root or the tree is not clean.
+if [ ! -e utils/gen-version.sh ] || [ ! -e .git ]; then
+ echo "This release script must be run from the root of libcamera git tree."
+ exit 1
+fi
+
+if ! git diff-index --quiet HEAD; then
+ echo "Tree must be clean to release."
+ exit 1
+fi
+
+# Identify current version components
+version=$(./utils/gen-version.sh)
+
+# Decide if we are here to bump major, minor, or patch release.
+case $1 in
+ major|minor|patch)
+ bump=$1;
+ ;;
+ *)
+ echo "You must specify the version bump level: (major, minor, patch)"
+ exit 1
+ ;;
+esac
+
+new_version=$(./utils/semver bump "$bump" "$version")
+
+echo "Bumping $bump"
+echo " Existing version is: $version"
+echo " New version is : $new_version"
+
+# Patch in the version to our meson.build
+sed -i -E "s/ version : '.*',/ version : '$new_version',/" meson.build
+
+# Commit the update
+git commit meson.build -esm "libcamera v$new_version"
+
+# Create a tag from that commit
+git show -s --format=%B | git tag "v$new_version" -s -F -