3 # the script will check out the correct branch, run "make distcheck",
4 # tag git, and upload the files to the GNU server.
6 # you need to have your GPG key registered with the GNU people for the upload to work!
8 # the script includes some minimal error checking and tries to automate the following:
9 # * check if the commit is already tagged
10 # * if version number includes a date like 20120304 (to be exact *20??????),
11 # it will create a developer release otherwise a normal release
12 # * if you have local tags that you don't want to upload, you need to add them further down to git tag -d ...
14 # you need to set the following to reasonable value for the script to work
16 # the script at the moment also only works for master and branches called v4*, easy to change in the script though
17 GITDIR=/home/arun/src/Prog/xboard
18 UPLOADDIR=/home/arun/tmp/xboard-upload
21 # default: make a release from master
25 echo >&2 "usage: $0 [-b branch]"
28 # check if we want to make a release from another branch
38 shift `expr $OPTIND - 1`
40 if [ $# -gt 0 ] ; then
45 # output information to the user and ask for confirmation
46 echo " Tagging and uploading new xboard release to GNU"
47 echo " branch: $BRANCH"
50 # go into a tmp directory, clone xboard, check out branch
58 read -n 1 -p "Should be on correct branch now. Continue?" REPLY
60 # get version information
62 VERSION=`grep AC_INIT configure.ac | sed -e 's/^.*\[.*\],\[\(.*\)\],.*$/\1/' `
64 #make sure we don't do things too often
65 RESULT=`git tag | grep "^$VERSION\$"`
66 if [ "$RESULT" != "" ] ; then
67 echo "this version is already tagged... exiting."
73 # output some summary information and have user confirm it
75 if [[ $BRANCH == v4* ]] ; then
81 FTPSERVER="ftp-upload.gnu.org"
82 if [[ $VERSION == *20?????? ]] ; then
83 TAGMESSAGE="new developer release"
84 FTPDIR="incoming/alpha"
86 TAGMESSAGE="new release of version $VERSION"
90 # ask for confirmation from user
91 echo " make sure that you are on the right commit (should be the one that changes the version number)!"
92 echo " version will be tagged as: $TAGNAME"
93 echo " tar ball will be named: xboard-${VERSION}.tar.gz "
94 echo " tag message: $TAGMESSAGE"
96 read -n 1 -p "Continue (y/N)?" REPLY
99 if [ "x$REPLY" != "xy" ]; then
104 echo "cleaning up tags"
105 # git tag -d <add tag name here, for more than one, add more lines like this one>
108 echo "tagging commit"
109 git tag -u $GPGKEYID -m "$TAGMESSAGE" $TAGNAME
111 echo "create tar ball"
114 TEX=tex make distcheck
116 if [ -s xboard-${VERSION}.tar.gz ] ; then
118 echo " make distcheck seems to be ok"
122 echo " problem with make distcheck"
127 echo "move tar ball to upload directory"
128 mv xboard-${VERSION}.tar.gz $UPLOADDIR
130 echo "cd into upload directory"
133 # create files necessary for upload to GNU
134 echo "creating directive"
137 filename: xboard-${VERSION}.tar.gz
138 comment: $TAGMESSAGE " > xboard-${VERSION}.tar.gz.directive
140 echo "signing packages"
141 gpg -b xboard-${VERSION}.tar.gz
142 gpg --clearsign xboard-${VERSION}.tar.gz.directive
147 The files can be found in $UPLOADDIR. Go and test them :)
149 Will do the following in a second followed by a git push
151 ftp -n -v $FTPSERVER <<EOT
154 put xboard-${VERSION}.tar.gz
155 put xboard-${VERSION}.tar.gz.sig
156 put xboard-${VERSION}.tar.gz.directive.asc
160 read -n 1 -p "Will upload and push tags now. Continue? (y/N)" REPLY
162 if [ "x$REPLY" != "xy" ]; then
168 ftp -n -v $FTPSERVER <<EOT
171 put xboard-${VERSION}.tar.gz
172 put xboard-${VERSION}.tar.gz.sig
173 put xboard-${VERSION}.tar.gz.directive.asc
178 echo "pushing tags and commits"
182 #possible to add other git repos here too
184 #git push --tags github
186 echo "done...have a nice day!"