#!/bin/bash PACKAGE_NAME='tufte-latex' CLASS_FILES="tufte-handout.cls tufte-book.cls" STYLE_FILES="tufte-common.sty" SOURCE_FILES="sample-handout.{pdf,tex,bib} sample-book.{pdf,tex}" # Exit on first error: set -e # Verify prerequisites: if test $# -ne 1 then echo "Usage: $0 VERSION" exit 1 fi CLASS_DATE=`date +%Y/%m/%d` # (with slashes) VERSION=$1 if ! echo $VERSION | grep -E "^[0-9]+\.[0-9]+\.[0-9]+$" then echo "VERSION should be of the form 1.2.5 (major.minor.revision)" exit 1 fi for CLASS in $CLASS_FILES; do if ! grep -q $VERSION $CLASS then echo "Error: version skew. '$VERSION' does not match that in $CLASS" grep -H ProvidesClass $CLASS exit 1 fi if ! grep -q $CLASS_DATE $CLASS; then echo "Error: date skew. '$CLASS_DATE' does not match that in $CLASS" grep -H ProvidesClass $CLASS exit 1 fi done for STYLE in $STYLE_FILES; do if ! grep -q $VERSION $STYLE then echo "Error: version skew. '$VERSION' does not match that in $STYLE" grep -H ProvidesPackage $STYLE exit 1 fi if ! grep -q $CLASS_DATE $STYLE then echo "Error: date skew. '$CLASS_DATE' does not match that in $STYLE" grep -H ProvidesPackage $STYLE exit 1 fi done if ! grep -q $VERSION History.txt then echo "Error: no release notes for '$VERSION' found in History.txt" grep -H $VERSION History.txt exit 1 fi HISTORY_DATE=`date +%Y-%m-%d` # (with dashes) if ! grep -q $history_date History.txt then echo "Error: '$history_date' not found in History.txt" grep -H $history_date History.txt exit 1 fi # Refresh sample documents pdflatex sample-handout > refresh-sample.log bibtex sample-handout >> refresh-sample.log pdflatex sample-handout >> refresh-sample.log pdflatex sample-handout >> refresh-sample.log rm -f sample-handout.{aux,log,out,blg,bbl} refresh-sample.log pdflatex sample-book > refresh-sample.log bibtex sample-book >> refresh-sample.log texindy --language english sample-book.idx >> refresh-sample.log pdflatex sample-book >> refresh-sample.log pdflatex sample-book >> refresh-sample.log rm -f sample-bok.{aux,log,out,blg,bbl,idx,ind,toc} refresh-sample.log # To ease googlecode upload, make a distinct version of sample-handout: cp sample-handout.pdf sample-handout-$version.pdf cp sample-book.pdf sample-book-$version.pdf # Make bundle for Google Code release mkdir -p pkg/$package-$version tar cf - `cat Manifest.txt` | ( cd pkg/$package-$version && tar xf - ) ( cd pkg && zip -rq $package-$version.zip $package-$version ) # Make bundle for CTAN release TDS_DIR=pkg/$package/tds/ TDS_TEX_DIR=$TDS_DIR/tex/latex/$package/ TDS_DOC_DIR=$TDS_DIR/doc/latex/$package/ TDS_SRC_DIR=$TDS_DIR/source/latex/$package/ mkdir -p $TDS_DIR $TDS_TEX_DIR $TDS_DOC_DIR $TDS_SRC_DIR cp $CLASS_FILES $STYLE_FILES $TDS_TEX_DIR/ cp History.txt README.txt sample-handout.{pdf,tex,bib} sample-book.{pdf,tex} $TDS_DOC_DIR/ mkdir $TDS_DOC_DIR/graphics cp graphics/* $TDS_DOC_DIR/graphics/ cp $CLASS_FILES $STYLE_FILES $SOURCE_FILES $TDS_SRC_DIR/ ( cd $TDS_DIR && zip -rq ../../$package-$version/$package.tds.zip * ) rm -fr pkg/$package mv pkg/$package-$version pkg/$package ( cd pkg && zip -rq $package.zip $package ) # Remove our temporary files rm -fr pkg/$package # Provide some cut-n-paste material for manual steps: cat << MESSAGE `openssl dgst -sha1 pkg/$package-$version.zip` Don't forget to create an SVN tag (after committing changes), svn cp -m'To tag release $version.' \\ https://$package.googlecode.com/svn/trunk \\ https://$package.googlecode.com/svn/tags/rel_$version and upload the zip file, http://code.google.com/p/$package/downloads/list http://ctan.org/upload MESSAGE