1#!/usr/bin/env bash 2 3# Guides my forgetful self through the release process. 4# Usage release.sh VERSION 5 6set -e 7 8function prompt() { 9 echo "$1 Confirm with 'Yes'" 10 read check 11 if [ "$check" != "Yes" ]; then 12 echo "Aborting..." 13 exit 1 14 fi 15} 16# http://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within 17DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 18OUTDIR=$(mktemp -d) 19TAG_NAME="v$1" 20 21cd $DIR 22 23echo ">>>>> Checking changelog" 24grep -A 5 -F $1 CHANGELOG.md || true 25prompt "Is the changelog correct and complete?" 26 27echo ">>>>> Checking Doxyfile" 28grep PROJECT_NUMBER Doxyfile 29prompt "Is the Doxyfile version correct?" 30 31echo ">>>>> Checking CMakeLists" 32grep -A 2 'SET(CBOR_VERSION_MAJOR' CMakeLists.txt 33prompt "Is the CMake version correct?" 34 35echo ">>>>> Checking docs" 36grep 'version =\|release =' doc/source/conf.py 37prompt "Are the versions correct?" 38 39set -x 40pushd doc 41make clean 42popd 43doxygen 44cd doc 45make html 46cd build 47 48cp -r html libcbor_docs_html 49tar -zcf libcbor_docs.tar.gz libcbor_docs_html 50 51cp -r doxygen/html libcbor_api_docs_html 52cp -r doxygen/html $DIR/docs/doxygen 53tar -zcf libcbor_api_docs.tar.gz libcbor_api_docs_html 54 55mv libcbor_docs.tar.gz libcbor_api_docs.tar.gz $OUTDIR 56 57cd $OUTDIR 58 59cmake $DIR -DCMAKE_BUILD_TYPE=Release -DWITH_TESTS=ON 60make 61ctest 62 63cd $DIR 64git add docs/doxygen 65git commit -m "[Release] Add current API documentation" 66 67prompt "Will proceed to tag the release with $TAG_NAME." 68git tag $TAG_NAME 69git push origin 70 71set +x 72 73echo "Release ready in $OUTDIR" 74echo "Add the release to GitHub at https://github.com/PJK/libcbor/releases/new *now*" 75prompt "Have you added the release to https://github.com/PJK/libcbor/releases/tag/$TAG_NAME?" 76 77set -x 78 79pushd docs 80erb index.html.erb > index.html 81git add index.html 82git commit -m "[Release] Update website to $TAG_NAME" 83git push 84 85set +x 86 87echo "Update the Hombrew tap (https://github.com/PJK/homebrew-libcbor) *now*" 88prompt "Have you updated the tap?"