Skip to content

Commit

Permalink
Add script to make sure CHANGELOG is always in sync with __version__ (
Browse files Browse the repository at this point in the history
#2297)

* Add script to make sure CHANGELOG is always in sync with `__version__`

* Fix version

* Change file permission

* Change head by sed
  • Loading branch information
Kludex committed Aug 20, 2022
1 parent 5af6123 commit 2b2269d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions scripts/check
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export SOURCE_FILES="httpx tests"

set -x

./scripts/sync-version
${PREFIX}black --check --diff --target-version=py36 $SOURCE_FILES
${PREFIX}flake8 $SOURCE_FILES
${PREFIX}mypy $SOURCE_FILES
Expand Down
11 changes: 11 additions & 0 deletions scripts/sync-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh -e

SEMVER_REGEX="([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?"
CHANGELOG_VERSION=$(grep -o -E $SEMVER_REGEX CHANGELOG.md | sed -n 2p)
VERSION=$(grep -o -E $SEMVER_REGEX httpx/__version__.py | head -1)
echo "CHANGELOG_VERSION: $CHANGELOG_VERSION"
echo "VERSION: $VERSION"
if [ "$CHANGELOG_VERSION" != "$VERSION" ]; then
echo "Version in changelog does not match version in httpx/__version__.py!"
exit 1
fi

0 comments on commit 2b2269d

Please sign in to comment.