| 1 | #! /bin/sh | 
|---|
| 2 |  | 
|---|
| 3 | # This script automates most of the process on making a new release. | 
|---|
| 4 |  | 
|---|
| 5 | set -e | 
|---|
| 6 |  | 
|---|
| 7 | rel=yes | 
|---|
| 8 | if test x"$1" = x-t ; then | 
|---|
| 9 |    rel= | 
|---|
| 10 |    shift | 
|---|
| 11 | fi | 
|---|
| 12 |  | 
|---|
| 13 | if test x"$rel" = xyes ; then | 
|---|
| 14 |   # Check there are no uncommitted changes. | 
|---|
| 15 |   if git commit -a --dry-run >/dev/null 2>/dev/null ; then | 
|---|
| 16 |     echo 'There are uncommitted changes - please rectify' | 
|---|
| 17 |     echo 'If you just want to test, run with option -t' | 
|---|
| 18 |     exit 1 | 
|---|
| 19 |   fi | 
|---|
| 20 |  | 
|---|
| 21 |   test ! -f Makefile || make distclean | 
|---|
| 22 |   cp -u /usr/share/misc/config.guess . | 
|---|
| 23 |   cp -u /usr/share/misc/config.sub . | 
|---|
| 24 |   mv INSTALL INSTALL.keep | 
|---|
| 25 |   autoreconf --force -i | 
|---|
| 26 |   mv INSTALL.keep INSTALL | 
|---|
| 27 |   ./configure CC=gcc CXX=g++ | 
|---|
| 28 |   # Don't error out on new GCC8 and GCC9 warnings for now. | 
|---|
| 29 |   make CFLAGS='-Werror' CXXFLAGS='-Werror -Wno-error=cast-function-type -Wno-error=deprecated-copy -Wno-error=ignored-qualifiers' | 
|---|
| 30 |   VALGRIND=valgrind make distcheck VERBOSE=1 | 
|---|
| 31 | else | 
|---|
| 32 |   make dist | 
|---|
| 33 | fi | 
|---|
| 34 |  | 
|---|
| 35 | if test x"$rel" = xyes ; then | 
|---|
| 36 |   rm -rf "$tardir" | 
|---|
| 37 | else | 
|---|
| 38 |   exit 0 | 
|---|
| 39 | fi | 
|---|
| 40 |  | 
|---|
| 41 | VERSION=`sed 's/^VERSION *= *//p;d' Makefile` | 
|---|
| 42 | HOST=thyestes.tartarus.org | 
|---|
| 43 |  | 
|---|
| 44 | echo 'Tagging' | 
|---|
| 45 | git tag -s -m"Survex $VERSION" "v$VERSION" | 
|---|
| 46 |  | 
|---|
| 47 | echo 'Pushing' | 
|---|
| 48 | git push --follow-tags | 
|---|
| 49 | ssh "$HOST" bin/survex-git-mirror | 
|---|
| 50 |  | 
|---|
| 51 | win32=survex-win32-$VERSION.exe | 
|---|
| 52 | echo "Download and unzip $win32 into `pwd`" | 
|---|
| 53 |  | 
|---|
| 54 | while test ! -f "$win32" ; do sleep 1 ; done | 
|---|
| 55 |  | 
|---|
| 56 | FILES="survex-$VERSION.tar.gz $win32" | 
|---|
| 57 | echo "SHA256 checksums:" | 
|---|
| 58 | sha256sum $FILES | 
|---|
| 59 | echo | 
|---|
| 60 |  | 
|---|
| 61 | for f in $FILES ; do | 
|---|
| 62 |     gpg --detach-sign --armour "$f" | 
|---|
| 63 |     FILES="$FILES $f.asc" | 
|---|
| 64 | done | 
|---|
| 65 |  | 
|---|
| 66 | echo "To upload to the webserver, run:" | 
|---|
| 67 |  | 
|---|
| 68 | echo ssh "$HOST" mkdir /srv/www/survex.com/software/"$VERSION" | 
|---|
| 69 | echo scp $FILES "$HOST":/srv/www/survex.com/software/"$VERSION" | 
|---|