From e7717af33c8ae0cd8458886f7359c9753746ed5f Mon Sep 17 00:00:00 2001 From: Marcelo Trylesinski Date: Fri, 8 Jul 2022 08:07:50 +0200 Subject: [PATCH] Add script to make sure CHANGELOG is always in sync with `__version__` (#1714) * Add script to make sure CHANGELOG is always in sync with `__version__` * Move script from lint to check * Update scripts/lint * Test to see if pipeline fails * Fix pipeline --- scripts/check | 1 + scripts/sync-version | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100755 scripts/sync-version diff --git a/scripts/check b/scripts/check index 23d50c7c..5a38477c 100755 --- a/scripts/check +++ b/scripts/check @@ -8,6 +8,7 @@ export SOURCE_FILES="starlette tests" set -x +./scripts/sync-version ${PREFIX}isort --check --diff --project=starlette $SOURCE_FILES ${PREFIX}black --check --diff $SOURCE_FILES ${PREFIX}flake8 $SOURCE_FILES diff --git a/scripts/sync-version b/scripts/sync-version new file mode 100755 index 00000000..67e9ef27 --- /dev/null +++ b/scripts/sync-version @@ -0,0 +1,9 @@ +#!/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 docs/release-notes.md | head -1) +VERSION=$(grep -o -E $SEMVER_REGEX starlette/__init__.py | head -1) +if [ "$CHANGELOG_VERSION" != "$VERSION" ]; then + echo "Version in changelog does not match version in starlette/__init__.py!" + exit 1 +fi