Skip to content

Commit

Permalink
Update release script
Browse files Browse the repository at this point in the history
  • Loading branch information
PJK committed Sep 20, 2020
1 parent 791c6d6 commit e9c4582
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ nbproject
doxygen_docs
*/*.out
cmake-build-debug
venv
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Next
---------------------

0.8.0 (2020-09-20)
---------------------
- BUILD BREAKING: Use BUILD_SHARED_LIBS to determine how to build libraries (fixed Windows linkage) [[#148]](https://github.com/PJK/libcbor/pull/148) (by [intelligide@](https://github.com/intelligide))
- BREAKING: Fix `cbor_tag_item` not increasing the reference count on the tagged item reference it returns [[Fixes #109](https://github.com/PJK/libcbor/issues/109)] (discovered bt [JohnGilmour](https://github.com/JohnGilmour))
- If you have previously relied on the broken behavior, you can use `cbor_move` to emulate as long as the returned handle is an "rvalue"
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules/")
include(CTest)

SET(CBOR_VERSION_MAJOR "0")
SET(CBOR_VERSION_MINOR "7")
SET(CBOR_VERSION_MINOR "8")
SET(CBOR_VERSION_PATCH "0")
SET(CBOR_VERSION ${CBOR_VERSION_MAJOR}.${CBOR_VERSION_MINOR}.${CBOR_VERSION_PATCH})

Expand Down
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "libcbor"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 0.7.0
PROJECT_NUMBER = 0.8.0

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
5 changes: 2 additions & 3 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,8 @@
# built documents.
#
# The short X.Y version.
version = '0.7'
# The full version, including alpha/beta/rc tags.
release = '0.7.0'
version = '0.8'
release = '0.8.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
38 changes: 38 additions & 0 deletions misc/update_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import sys, re
from datetime import date

version = sys.argv[1]
release_date = date.today().strftime('%Y-%m-%d')
major, minor, patch = version.split('.')


def replace(file_path, pattern, replacement):
updated = re.sub(pattern, replacement, open(file_path).read())
with open(file_path, 'w') as f:
f.write(updated)

# Update changelog
SEP = '---------------------'
NEXT = f'Next\n{SEP}'
changelog_header = f'{NEXT}\n\n{version} ({release_date})\n{SEP}'
replace('CHANGELOG.md', NEXT, changelog_header)

# Update Doxyfile
DOXY_VERSION = 'PROJECT_NUMBER = '
replace('Doxyfile', DOXY_VERSION + '.*', DOXY_VERSION + version)

# Update CMakeLists.txt
replace('CMakeLists.txt',
'''SET\\(CBOR_VERSION_MAJOR "0"\\)
SET\\(CBOR_VERSION_MINOR "7"\\)
SET\\(CBOR_VERSION_PATCH "0"\\)''',
f'''SET(CBOR_VERSION_MAJOR "{major}")
SET(CBOR_VERSION_MINOR "{minor}")
SET(CBOR_VERSION_PATCH "{patch}")''')

# Update Sphinx
replace('doc/source/conf.py',
"""version = '.*'
release = '.*'""",
f"""version = '{major}.{minor}'
release = '{major}.{minor}.{patch}'""")
11 changes: 6 additions & 5 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ OUTDIR=$(mktemp -d)
TAG_NAME="v$1"

cd $DIR
python3 misc/update_version.py "$1"

echo ">>>>> Checking changelog"
grep -A 5 -F $1 CHANGELOG.md || true
grep -A 5 -F "$1" CHANGELOG.md || true
prompt "Is the changelog correct and complete?"

echo ">>>>> Checking Doxyfile"
Expand Down Expand Up @@ -51,16 +52,16 @@ tar -zcf libcbor_docs.tar.gz libcbor_docs_html
cp -r doxygen/html libcbor_api_docs_html
tar -zcf libcbor_api_docs.tar.gz libcbor_api_docs_html

mv libcbor_docs.tar.gz libcbor_api_docs.tar.gz $OUTDIR
mv libcbor_docs.tar.gz libcbor_api_docs.tar.gz "$OUTDIR"

pushd $OUTDIR
cmake $DIR -DCMAKE_BUILD_TYPE=Release -DWITH_TESTS=ON
pushd "$OUTDIR"
cmake "$DIR" -DCMAKE_BUILD_TYPE=Release -DWITH_TESTS=ON
make
ctest
popd

prompt "Will proceed to tag the release with $TAG_NAME."
git tag $TAG_NAME
git tag "$TAG_NAME"
git push --tags

set +x
Expand Down

0 comments on commit e9c4582

Please sign in to comment.