xref: /freebsd/contrib/libcbor/release.sh (revision 6ba2210ee039f2f12878c217bcf058e9c8b26b29)
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
22python3 misc/update_version.py "$1"
23
24echo ">>>>> Checking changelog"
25grep -A 5 -F "$1" CHANGELOG.md || true
26prompt "Is the changelog correct and complete?"
27
28echo ">>>>> Checking Doxyfile"
29grep PROJECT_NUMBER Doxyfile
30prompt "Is the Doxyfile version correct?"
31
32echo ">>>>> Checking CMakeLists"
33grep -A 2 'SET(CBOR_VERSION_MAJOR' CMakeLists.txt
34prompt "Is the CMake version correct?"
35
36echo ">>>>> Checking docs"
37grep 'version =\|release =' doc/source/conf.py
38prompt "Are the versions correct?"
39
40set -x
41pushd doc
42make clean
43popd
44doxygen
45cd doc
46make html
47cd build
48
49cp -r html libcbor_docs_html
50tar -zcf libcbor_docs.tar.gz libcbor_docs_html
51
52cp -r doxygen/html libcbor_api_docs_html
53tar -zcf libcbor_api_docs.tar.gz libcbor_api_docs_html
54
55mv libcbor_docs.tar.gz libcbor_api_docs.tar.gz "$OUTDIR"
56
57pushd "$OUTDIR"
58cmake "$DIR" -DCMAKE_BUILD_TYPE=Release -DWITH_TESTS=ON
59make
60ctest
61popd
62
63prompt "Will proceed to tag the release with $TAG_NAME."
64git tag "$TAG_NAME"
65git push --tags
66
67set +x
68
69echo "Release ready in $OUTDIR"
70echo "Add the release to GitHub at https://github.com/PJK/libcbor/releases/new *now*"
71prompt "Have you added the release to https://github.com/PJK/libcbor/releases/tag/$TAG_NAME?"
72
73echo "Update the Hombrew formula (https://github.com/Homebrew/homebrew-core/blob/master/Formula/libcbor.rb) *now*"
74echo "HOWTO: https://github.com/Linuxbrew/brew/blob/master/docs/How-To-Open-a-Homebrew-Pull-Request.md"
75prompt "Have you updated the formula?"
76