diff options
author | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2022-11-25 13:56:11 +0000 |
---|---|---|
committer | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2022-11-25 16:29:24 +0000 |
commit | 936e5f253ef888c043f61ba6a8bb497f50dda368 (patch) | |
tree | d7bb41ebc881c0322b7c8f7063c3acb119707abc /scripts/release.sh | |
parent | 7f07136ed46bd36a22d6fb3bd4b6d3b844815379 (diff) |
scripts: Provide a release script
Support making releases of uvc-gadget by introducing a helper script
which will facilitate the increment of any release version, along with
generating an associated tag, derived from the equivalent implementation
in libcamera [0].
[0] https://git.libcamera.org/libcamera/libcamera.git/tree/utils/release.sh?h=v0.0.2
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'scripts/release.sh')
-rwxr-xr-x | scripts/release.sh | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100755 index 0000000..2de0063 --- /dev/null +++ b/scripts/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 scripts/gen-version.sh ] || [ ! -e .git ]; then + echo "This release script must be run from the root of uvc-gadget 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=$(./scripts/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=$(./scripts/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 "uvc-gadget v$new_version" + +# Create a tag from that commit +git show -s --format=%B | git tag "v$new_version" -s -F - |