Debian Codegraph @

tools/create_release.sh

raw symbols SCIP
1 #!/bin/sh
2 # Create git tag
3 #
4 # SPDX-FileCopyrightText: 2024 Johnny Jazeix <[email protected]>
5 #
6 # SPDX-License-Identifier: GPL-3.0-or-later
7
8 function usage() {
9 echo "Usage: ./tools/create_release.sh -v <version> [-r <date>] [-h]"
10 echo " -v, --version <version> contains the new version <major>.<minor>.<patch>"
11 echo " -r, --release <date> contains the date of the release YYYY-MM-DD (optional)"
12 echo " -h, --help displays this help"
13 }
14
15 if [ ! -f io.github.petitlapin.Li-ri.appdata.xml ]
16 then
17 echo "ERROR: Run me from the top level source dir"
18 exit 1
19 fi
20
21 while [[ $# -gt 0 ]]; do
22 case $1 in
23 -v|--version)
24 VERSION="$2"
25 shift # past argument
26 shift # past value
27 ;;
28 -r|--release)
29 DATE="$2"
30 shift # past argument
31 shift # past value
32 ;;
33 -h|--help)
34 usage;
35 exit 0
36 ;;
37 -*|--*)
38 echo "Unknown option $1"
39 exit 1
40 ;;
41 *)
42 POSITIONAL_ARGS+=("$1") # save positional arg
43 shift # past argument
44 ;;
45 esac
46 done
47
48 if [[ ! "${VERSION}" ]]
49 then
50 echo "Mission version"
51 usage
52 exit 1
53 fi
54
55 major=`echo $VERSION | cut -d. -f1`
56 minor=`echo $VERSION | cut -d. -f2`
57 patch=`echo $VERSION | cut -d. -f3`
58
59 version=${major}.${minor}.${patch}
60 echo "Version = $version"
61 echo "Date = ${DATE}"
62
63 ./tools/bump_version.sh -v ${VERSION} -c
64
65 # TODO
66 if [[ "${CHANGELOG}" ]]
67 then
68 git tag -a v${VERSION} -m "create tag v${VERSION}"
69 fi