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]\>
24 while getopts "v:s:p:hr" option
28 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"
31 v) version="$OPTARG" ;;
41 printf '%s\n' "Directory .git does not exist"
45 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
50 if [ -n "$start" ] && [ -n "$patch" ]
52 printf '%s\n' "Cannot have start-hash and patch number together"
56 if [ "$(printf '%s\n' "$version" | awk -F"." '{print NF-1}')" -ne 1 ]
58 printf '%s\n' "Version major.minor $version is not valid"
64 if ! git branch master --contains "$start" > /dev/null 2>&1
66 printf '%s\n' "Start hash is not in master branch"
73 if ! git rev-parse stable/"$version" > /dev/null 2>&1
75 printf '%s\n' "Version $version does not exist"
79 if ! [ "$patch" -ge 0 ] 2> /dev/null
81 printf '%s\n' "Patch $patch is not an integer"
85 if git rev-parse stable/"$version" > /dev/null 2>&1
87 printf '%s\n' "Version $version already exists"
96 revision="$version.$patch"
103 git checkout -b stable/"$version"
105 git checkout -b stable/"$version" "$start"
108 if [ "$push" = true ]
110 git push git@geeqie.org:geeqie stable/"$version"
113 git checkout stable/"$version"
116 sudo make maintainer-clean
119 ./scripts/generate-man-page.sh
122 git add org.geeqie.Geeqie.appdata.xml.in
124 git add doc/docbook/CommandLineOptions.xml
125 git commit --message="Preparing for release v$revision"
127 if [ "$push" = true ]
129 git push git@geeqie.org:geeqie
132 git tag --sign "v$revision" --message="Release v$revision"
134 if [ "$push" = true ]
136 git push git@geeqie.org:geeqie "v$revision"
139 sudo make maintainer-clean
142 rm -rf /tmp/geeqie-"$revision".tar.xz
143 rm -rf /tmp/geeqie-"$revision".tar.xz.asc
145 # shellcheck disable=SC2140
146 tar --create --xz --file=/tmp/geeqie-"$revision".tar.xz --exclude=".git" --exclude="configure" --exclude="web" --transform s/"\bgeeqie\b"/"geeqie-$revision"/ ../geeqie
147 gpg --armor --detach-sign --output /tmp/geeqie-"$revision".tar.xz.asc /tmp/geeqie-"$revision".tar.xz
151 git checkout stable/"$version" NEWS
152 git checkout stable/"$version" geeqie.1
153 git checkout stable/"$version" doc/docbook/CommandLineOptions.xml
154 git checkout stable/"$version" org.geeqie.Geeqie.appdata.xml.in
157 git add org.geeqie.Geeqie.appdata.xml.in
159 git add doc/docbook/CommandLineOptions.xml
160 git commit --message="Release v$revision files"
162 if [ "$push" = true ]
164 git push git@geeqie.org:geeqie
167 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