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 ./scripts/generate-man-page.sh
117 ./doc/create-shortcuts-xml.sh
120 git add org.geeqie.Geeqie.appdata.xml.in
122 git add doc/docbook/CommandLineOptions.xml
123 git commit --message="Preparing for release v$revision"
125 if [ "$push" = true ]
127 git push git@geeqie.org:geeqie
130 git tag --sign "v$revision" --message="Release v$revision"
132 if [ "$push" = true ]
134 git push git@geeqie.org:geeqie "v$revision"
137 rm -rf /tmp/geeqie-"$revision".tar.xz
138 rm -rf /tmp/geeqie-"$revision".tar.xz.asc
140 # shellcheck disable=SC2140
141 tar --create --xz --file=/tmp/geeqie-"$revision".tar.xz --exclude=".git" --exclude="configure" --exclude="web" --transform s/"\bgeeqie\b"/"geeqie-$revision"/ ../geeqie
142 gpg --armor --detach-sign --output /tmp/geeqie-"$revision".tar.xz.asc /tmp/geeqie-"$revision".tar.xz
146 git checkout stable/"$version" NEWS
147 git checkout stable/"$version" geeqie.1
148 git checkout stable/"$version" doc/docbook/CommandLineOptions.xml
149 git checkout stable/"$version" org.geeqie.Geeqie.appdata.xml.in
152 git add org.geeqie.Geeqie.appdata.xml.in
154 git add doc/docbook/CommandLineOptions.xml
155 git commit --message="Release v$revision files"
157 if [ "$push" = true ]
159 git push git@geeqie.org:geeqie
162 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