From c833b9334bc116acc28d37676976e919f1e71fe6 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sat, 17 Oct 2015 10:42:06 +0100 Subject: [PATCH] Check and commit changelog in version_utils.sh when creating release tag. --- version_utils.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/version_utils.sh b/version_utils.sh index 579a3713de..a7df83bcd4 100755 --- a/version_utils.sh +++ b/version_utils.sh @@ -119,7 +119,13 @@ if [ -n "$WRITE" ]; then mv .ottdrev-vc-tmp .ottdrev-vc fi +function unignore_files { + git update-index --no-assume-unchanged README.md jgrpp-changelog.md +} + if [ -n "$RELEASETAG" ]; then + git update-index --assume-unchanged README.md jgrpp-changelog.md + trap unignore_files EXIT if ! git diff-index --quiet HEAD; then echo "Repo is dirty, aborting" >&2 exit 1 @@ -128,6 +134,12 @@ if [ -n "$RELEASETAG" ]; then echo "Repo is dirty, aborting" >&2 exit 1 fi + if [ "${RELEASETAG:0:6}" = "jgrpp-" -a -n "${RELEASETAG:6}" ]; then + if ! grep -q -e "^### v${RELEASETAG:6} (" jgrpp-changelog.md; then + echo "v${RELEASETAG:6} is not in changelog, aborting" >&2 + exit 1 + fi + fi if ! git tag "$RELEASETAG"; then echo "Tag already exists or is not valid, aborting" >&2 exit 1 @@ -135,10 +147,12 @@ if [ -n "$RELEASETAG" ]; then if ! ./version_utils.sh -w; then exit 1 fi + unignore_files + trap '' EXIT if [ "${RELEASETAG:0:6}" = "jgrpp-" -a -n "${RELEASETAG:6}" ]; then sed -i "1 s/^\(## JGR's Patchpack version \).\+/\1${RELEASETAG:6}/" README.md fi - git add .ottdrev-vc README.md + git add .ottdrev-vc README.md jgrpp-changelog.md git commit -m "Version: Committing version data for tag: $RELEASETAG" git tag -f "$RELEASETAG" fi