From 54842274d3657bff231af6a3c9a465d84f729f79 Mon Sep 17 00:00:00 2001 From: Pavel Punsky Date: Sun, 20 Nov 2022 14:23:17 -0800 Subject: [PATCH] Scripts to generate AUTHORS and ChangeLog (#1101) Originated by @KangLin in #1097 Create scripts that generate ChangeLog and Authors - can be combined/called by other scripts during build process Scripts are idempotent: running them multiple times should not change anything They do not commit or tag - up to the author/reviewer to make those changes The lists are generated in Markdown compatible format (so that we can change those files to .md in the future) NOTES: - Authors file is generated in alphabetical order, disregarding specific contributions - ChangeLog file is generated in order of commits, omitting bot commits (dependabot) Co-authored-by: Kang Lin --- authors.sh | 14 ++++++++++++++ release.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100755 authors.sh create mode 100755 release.sh diff --git a/authors.sh b/authors.sh new file mode 100755 index 0000000..8f1e24d --- /dev/null +++ b/authors.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -e + +SOURCE_DIR=`pwd` + +# Generate AUTHORS +echo "Thanks to the following contributors (in alphabetical order):" > ${SOURCE_DIR}/AUTHORS +echo "" >> ${SOURCE_DIR}/AUTHORS +echo "`git log --pretty=format:'- %an <%ae>' | grep -v dependabot | sort | uniq`" >> ${SOURCE_DIR}/AUTHORS +echo "" >> ${SOURCE_DIR}/AUTHORS +echo "Use the following command to query the author's commit:" >> ${SOURCE_DIR}/AUTHORS +echo " git log --author='author'" >> ${SOURCE_DIR}/AUTHORS +echo "Or see [ChangeLog](ChangeLog)" >> ${SOURCE_DIR}/AUTHORS diff --git a/release.sh b/release.sh new file mode 100755 index 0000000..f5aeaba --- /dev/null +++ b/release.sh @@ -0,0 +1,48 @@ +#!/bin/bash +#! Author: Kang Lin + +set -e + +SOURCE_DIR=`pwd` + +if [ -n "$1" ]; then + VERSION=$1 + + if [ -n "$2" ]; then + MESSAGE=$2 + fi + PRE_TAG=`git tag --sort=-creatordate | grep -v -E "upstream|docker|debian" | head -n 1` + echo "Current version: $PRE_TAG. The version to will be set: $1 $MESSAGE" +else + echo "usage: $0 release_version [release_message]" + echo " release_version format: [v][0-9].[0-9].[0-9]" + exit -1 +fi + +if [ -z "${MESSAGE}" ]; then + MESSAGE="Release $1" +else + MESSAGE="Release $1: ${MESSAGE}" +fi + +VERSION=$1 + +sed -i "s/SET(BUILD_VERSION \".*)/SET(BUILD_VERSION \"${VERSION}\")/g" ${SOURCE_DIR}/CMakeLists.txt +sed -i "s/#define TURN_SERVER_VERSION .*/#define TURN_SERVER_VERSION \"${VERSION}\"/g" ${SOURCE_DIR}/src/ns_turn_defs.h + +# Generate ChangeLog +if [ -f ${SOURCE_DIR}/ChangeLog ]; then + mv ${SOURCE_DIR}/ChangeLog ${SOURCE_DIR}/ChangeLog.tmp +fi + +echo "$MESSAGE" > ${SOURCE_DIR}/ChangeLog +echo "" >> ${SOURCE_DIR}/ChangeLog +echo "Changelist:" >> ${SOURCE_DIR}/ChangeLog +echo "`git log --pretty=format:'- %s (%an <%ae>)' ${PRE_TAG}..HEAD | grep -v dependabot`" >> ${SOURCE_DIR}/ChangeLog +echo "" >> ${SOURCE_DIR}/ChangeLog +echo "Contributors:" >> ${SOURCE_DIR}/ChangeLog +echo "`git log --pretty=format:'- %an <%ae>' ${PRE_TAG}..HEAD|sort|uniq`" >> ${SOURCE_DIR}/ChangeLog +echo "" >> ${SOURCE_DIR}/ChangeLog + +cat ${SOURCE_DIR}/ChangeLog.tmp >> ${SOURCE_DIR}/ChangeLog +rm ${SOURCE_DIR}/ChangeLog.tmp