110ff414cSEd Maste#!/usr/bin/env bash 210ff414cSEd Maste 310ff414cSEd Maste# Guides my forgetful self through the release process. 410ff414cSEd Maste# Usage release.sh VERSION 510ff414cSEd Maste 610ff414cSEd Masteset -e 710ff414cSEd Maste 810ff414cSEd Mastefunction prompt() { 910ff414cSEd Maste echo "$1 Confirm with 'Yes'" 1010ff414cSEd Maste read check 1110ff414cSEd Maste if [ "$check" != "Yes" ]; then 1210ff414cSEd Maste echo "Aborting..." 1310ff414cSEd Maste exit 1 1410ff414cSEd Maste fi 1510ff414cSEd Maste} 1610ff414cSEd Maste# http://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within 1710ff414cSEd MasteDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 1810ff414cSEd MasteOUTDIR=$(mktemp -d) 1910ff414cSEd MasteTAG_NAME="v$1" 2010ff414cSEd Maste 2110ff414cSEd Mastecd $DIR 2210ff414cSEd Mastepython3 misc/update_version.py "$1" 2310ff414cSEd Maste 2410ff414cSEd Masteecho ">>>>> Checking changelog" 25*5d3e7166SEd Mastegrep -A 10 -F "$1" CHANGELOG.md || true 2610ff414cSEd Masteprompt "Is the changelog correct and complete?" 2710ff414cSEd Maste 2810ff414cSEd Masteecho ">>>>> Checking Doxyfile" 2910ff414cSEd Mastegrep PROJECT_NUMBER Doxyfile 3010ff414cSEd Masteprompt "Is the Doxyfile version correct?" 3110ff414cSEd Maste 3210ff414cSEd Masteecho ">>>>> Checking CMakeLists" 3310ff414cSEd Mastegrep -A 2 'SET(CBOR_VERSION_MAJOR' CMakeLists.txt 3410ff414cSEd Masteprompt "Is the CMake version correct?" 3510ff414cSEd Maste 36*5d3e7166SEd Masteecho ">>>>> Checking Bazel build" 37*5d3e7166SEd Mastegrep -A 2 'CBOR_MAJOR_VERSION' examples/bazel/third_party/libcbor/cbor/configuration.h 38*5d3e7166SEd Masteprompt "Is the version correct?" 39*5d3e7166SEd Maste 4010ff414cSEd Masteecho ">>>>> Checking docs" 4110ff414cSEd Mastegrep 'version =\|release =' doc/source/conf.py 4210ff414cSEd Masteprompt "Are the versions correct?" 4310ff414cSEd Maste 4410ff414cSEd Masteset -x 4510ff414cSEd Mastepushd doc 4610ff414cSEd Mastemake clean 4710ff414cSEd Mastepopd 4810ff414cSEd Mastedoxygen 4910ff414cSEd Mastecd doc 5010ff414cSEd Mastemake html 5110ff414cSEd Mastecd build 5210ff414cSEd Maste 5310ff414cSEd Mastecp -r html libcbor_docs_html 5410ff414cSEd Mastetar -zcf libcbor_docs.tar.gz libcbor_docs_html 5510ff414cSEd Maste 5610ff414cSEd Mastecp -r doxygen/html libcbor_api_docs_html 5710ff414cSEd Mastetar -zcf libcbor_api_docs.tar.gz libcbor_api_docs_html 5810ff414cSEd Maste 5910ff414cSEd Mastemv libcbor_docs.tar.gz libcbor_api_docs.tar.gz "$OUTDIR" 6010ff414cSEd Maste 6110ff414cSEd Mastepushd "$OUTDIR" 6210ff414cSEd Mastecmake "$DIR" -DCMAKE_BUILD_TYPE=Release -DWITH_TESTS=ON 6310ff414cSEd Mastemake 6410ff414cSEd Mastectest 6510ff414cSEd Mastepopd 6610ff414cSEd Maste 6710ff414cSEd Masteprompt "Will proceed to tag the release with $TAG_NAME." 68*5d3e7166SEd Mastegit commit -a -m "Release $TAG_NAME" 6910ff414cSEd Mastegit tag "$TAG_NAME" 70*5d3e7166SEd Mastegit push --set-upstream origin $(git rev-parse --abbrev-ref HEAD) 7110ff414cSEd Mastegit push --tags 7210ff414cSEd Maste 7310ff414cSEd Masteset +x 7410ff414cSEd Maste 7510ff414cSEd Masteecho "Release ready in $OUTDIR" 7610ff414cSEd Masteecho "Add the release to GitHub at https://github.com/PJK/libcbor/releases/new *now*" 7710ff414cSEd Masteprompt "Have you added the release to https://github.com/PJK/libcbor/releases/tag/$TAG_NAME?" 7810ff414cSEd Maste 7910ff414cSEd Masteecho "Update the Hombrew formula (https://github.com/Homebrew/homebrew-core/blob/master/Formula/libcbor.rb) *now*" 8010ff414cSEd Masteecho "HOWTO: https://github.com/Linuxbrew/brew/blob/master/docs/How-To-Open-a-Homebrew-Pull-Request.md" 8110ff414cSEd Masteprompt "Have you updated the formula?" 82