4 ## @brief Create a new release
6 ## new-release.sh [option]...\n
8 ## -v \<a.b\> is a major.minor version number\n
9 ## -s \<c\> is the start hash number for a new major.minor release - if omitted, HEAD is used\n
10 ## -p \<d\> is the patch version if a major.minor.patch release is being created\n
11 ## -r Push the release to the repo. If omitted a test run is made (run from a temp. clone folder)\n
14 ## Will create a new release off the master branch, or will create a new
15 ## patch version off an existing major.minor release branch.
17 ## It is expected that the first line of NEWS is in the form "Geeqie \<a.b[.d]\>
22 echo "Error on line: $1"
25 trap 'error_handler ${LINENO}' ERR
32 while getopts "v:s:p:hr" option
36 printf '%s\n%s\n%s\n%s\n%s\n' "-v <a.b> release major.minor e.g 1.9" "-s <c> start hash e.g. 728172681 (optional)" "-p <d> release patch version e.g. 2 for 1.6.2" "-r push to repo." "-h help"
39 v) version="$OPTARG" ;;
49 printf '%s\n' "Directory .git does not exist"
53 if ! zenity --title="NEW RELEASE" --question --text "Edit the following files before running\n this script:\n\nNEWS\norg.geeqie.Geeqie.appdata.xml.in\n\nContinue?" --width=300
58 if [ -n "$start" ] && [ -n "$patch" ]
60 printf '%s\n' "Cannot have start-hash and patch number together"
64 if [ "$(printf '%s\n' "$version" | awk -F"." '{print NF-1}')" -ne 1 ]
66 printf '%s\n' "Version major.minor $version is not valid"
72 if ! git branch master --contains "$start" > /dev/null 2>&1
74 printf '%s\n' "Start hash is not in master branch"
81 if ! git rev-parse stable/"$version" > /dev/null 2>&1
83 printf '%s\n' "Version $version does not exist"
87 if ! [ "$patch" -ge 0 ] 2> /dev/null
89 printf '%s\n' "Patch $patch is not an integer"
93 if git rev-parse stable/"$version" > /dev/null 2>&1
95 printf '%s\n' "Version $version already exists"
104 revision="$version.$patch"
111 git checkout -b stable/"$version"
113 git checkout -b stable/"$version" "$start"
116 if [ "$push" = true ]
118 git push git@geeqie.org:geeqie stable/"$version"
121 git checkout stable/"$version"
124 # Regenerate to get the new version number in the man page
129 if ! ./scripts/generate-man-page.sh
131 printf '%s\n' "generate-man-page.sh failed"
134 if ! ./doc/create-shortcuts-xml.sh
136 printf '%s\n' "create-shortcuts-xml.sh failed"
141 git add org.geeqie.Geeqie.appdata.xml.in
143 git add doc/docbook/CommandLineOptions.xml
144 git commit --message="Preparing for release v$revision"
146 if [ "$push" = true ]
148 git push git@geeqie.org:geeqie
151 git tag --sign "v$revision" --message="Release v$revision"
153 if [ "$push" = true ]
155 git push git@geeqie.org:geeqie "v$revision"
158 rm -rf /tmp/geeqie-"$revision".tar.xz
159 rm -rf /tmp/geeqie-"$revision".tar.xz.asc
162 # shellcheck disable=SC2140
163 tar --create --xz --file=/tmp/geeqie-"$revision".tar.xz --exclude=".git" --exclude="configure" --exclude="web" --transform s/"\bgeeqie\b"/"geeqie-$revision"/ ../geeqie
164 gpg --armor --detach-sign --output /tmp/geeqie-"$revision".tar.xz.asc /tmp/geeqie-"$revision".tar.xz
168 git checkout stable/"$version" NEWS
169 git checkout stable/"$version" geeqie.1
170 git checkout stable/"$version" doc/docbook/CommandLineOptions.xml
171 git checkout stable/"$version" org.geeqie.Geeqie.appdata.xml.in
174 git add org.geeqie.Geeqie.appdata.xml.in
176 git add doc/docbook/CommandLineOptions.xml
177 git commit --message="Release v$revision files"
179 if [ "$push" = true ]
181 git push git@geeqie.org:geeqie
184 zenity --info --window-icon="info" --text="Upload files:\n\n/tmp/geeqie-$revision.tar.xz\n/tmp/geeqie-$revision.tar.xz.asc\n\nto https://github.com/BestImageViewer/geeqie/releases" --width=400