1#!/bin/bash 2 3cd "`dirname "$0"`" 4 5# Read version number 6eval `awk '/Vc_VERSION_NUMBER 0x[0-9]+/ { h=$3 } 7END { 8major=strtonum(substr(h, 1, 4)) 9minor=strtonum("0x" substr(h, 5, 2)) 10patch=strtonum("0x" substr(h, 7, 2)) / 2 11printf "oldVersion=\"%d.%d.%d\"\n", major, minor, patch 12printf "newVersion=\"%d.%d.%d\"\n", major, minor, patch + 1 13}' Vc/version.h` 14echo "current version: $oldVersion" 15echo -n " new release: " 16read -e -i "$newVersion" newVersion 17 18versionString=$newVersion 19versionNumber=`echo $newVersion | awk '{ split($0, v, "."); printf "0x%02x%02x%02x", v[1], v[2], v[3] * 2 }'` 20 21# Update the version number 22sed -i \ 23 -e "s/^PROJECT_NUMBER = .*\$/PROJECT_NUMBER = $versionString/" \ 24 -e "s/^HTML_TIMESTAMP = YES/HTML_TIMESTAMP = NO/" \ 25 doc/Doxyfile 26sed -i \ 27 -e "s/Vc_VERSION_STRING \".*\"\$/Vc_VERSION_STRING \"$versionString\"/" \ 28 -e "s/Vc_VERSION_NUMBER 0x.*\$/Vc_VERSION_NUMBER $versionNumber/" \ 29 Vc/version.h 30cat Vc/version.h 31 32# Modify README.md to link to release docs 33ed README.md <<EOF 34P 35/github.io/a 36* [$versionString release](https://vcdevel.github.io/Vc-$versionString/) 37. 38w 39EOF 40 41# Don't build tests with make all 42sed -i -e 's/#Release# //' CMakeLists.txt 43git commit README.md CMakeLists.txt doc/Doxyfile Vc/version.h -s -F- <<EOF 44release: version $versionString 45 46* change version strings/numbers to $versionString 47* disable HTML_TIMESTAMP for doxygen 48* don't build tests with make all 49* Add documentation link to Vc-$versionString 50EOF 51 52git tag -m "Vc $versionString release" -s "$versionString" || exit 53 54# Create tarball 55git archive --format=tar --prefix="Vc-$versionString/" "$versionString" | gzip > ../"Vc-$versionString.tar.gz" 56 57# Create API docs tarball 58./makeApidox.sh 59 60# Copy API docs to vcdevel.github.io 61git clone --depth 2 git@github.com:VcDevel/vcdevel.github.io && \ 62cp -a doc/html vcdevel.github.io/Vc-$versionString && \ 63cd vcdevel.github.io && \ 64git add Vc-$versionString && \ 65git commit -m "Add Vc $versionString release docs" && \ 66git push && \ 67cd .. && \ 68rm -r vcdevel.github.io 69 70# Create API docs tarball 71mv doc/html/*.qch "../Vc-${versionString}.qch" 72mv doc/html "Vc-docs-$versionString" && tar -czf "../Vc-docs-$versionString".tar.gz "Vc-docs-$versionString" 73rm -rf "Vc-docs-$versionString" 74 75# Get back to the state before the tag and fix up the version numbers afterwards 76git revert -n HEAD 77git reset HEAD README.md && git checkout README.md 78 79# Update the version number of the after-release code 80versionString="$versionString-dev" 81versionNumber=`echo $versionNumber | awk '{ printf "0x%06x", (strtonum($0) + 1) }'` 82 83sed -i \ 84 -e "s/^PROJECT_NUMBER = .*\$/PROJECT_NUMBER = $versionString/" \ 85 -e "s/^HTML_TIMESTAMP = YES/HTML_TIMESTAMP = NO/" \ 86 doc/Doxyfile 87sed -i \ 88 -e "s/Vc_VERSION_STRING \".*\"\$/Vc_VERSION_STRING \"$versionString\"/" \ 89 -e "s/Vc_VERSION_NUMBER 0x.*\$/Vc_VERSION_NUMBER $versionNumber/" \ 90 Vc/version.h 91git commit CMakeLists.txt doc/Doxyfile Vc/version.h -s -F- <<EOF 92after release: version $versionString 93 94* change version strings/numbers to $versionString 95* enable HTML_TIMESTAMP for doxygen 96* build tests with make all 97EOF 98