From cfd0e36f96914ee5bf98b8ef0def29d022b8b056 Mon Sep 17 00:00:00 2001 From: Mauro Lacy Date: Fri, 17 Sep 2021 08:50:13 +0200 Subject: [PATCH 01/10] update_changelog exec perms --- scripts/update_changelog.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/update_changelog.sh diff --git a/scripts/update_changelog.sh b/scripts/update_changelog.sh old mode 100644 new mode 100755 From ac11eee6b40220da7e4bff0225f238c3dc8162bd Mon Sep 17 00:00:00 2001 From: Mauro Lacy Date: Fri, 17 Sep 2021 08:50:35 +0200 Subject: [PATCH 02/10] Add passing extra params to update changelog script --- scripts/update_changelog.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/update_changelog.sh b/scripts/update_changelog.sh index c67effbb3..1256dd3c4 100755 --- a/scripts/update_changelog.sh +++ b/scripts/update_changelog.sh @@ -1,3 +1,3 @@ #!/bin/bash -github_changelog_generator -u CosmWasm -p cw-plus --base CHANGELOG.md +github_changelog_generator -u CosmWasm -p cw-plus --base CHANGELOG.md $@ From fc65261605d8048cb5a66ff6ab419962b0e51a5e Mon Sep 17 00:00:00 2001 From: Mauro Lacy Date: Fri, 17 Sep 2021 11:55:09 +0200 Subject: [PATCH 03/10] Add --since-tag parameter / latest tag detection --- scripts/update_changelog.sh | 38 ++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/scripts/update_changelog.sh b/scripts/update_changelog.sh index 1256dd3c4..ce49ecb59 100755 --- a/scripts/update_changelog.sh +++ b/scripts/update_changelog.sh @@ -1,3 +1,39 @@ #!/bin/bash -github_changelog_generator -u CosmWasm -p cw-plus --base CHANGELOG.md $@ + +ORIGINAL_OPTS="$@" +OPTS=$(getopt -l "help,since-tag:,latest-tag" -o "hl" -- "$@") || exit 1 + +eval set -- "$OPTS" +while true +do +case $1 in + -h|--help) + echo -e "Usage: $0 [--since-tag ]\n + -h, --help Display help\n + --since-tag Process changes since tag \r + -l, --latest-tag Process changes since latest tag" + exit 0 + ;; +--since-tag) + shift + TAG="$1" + ;; +-l|--latest-tag) + TAG=$(git tag --sort=creatordate | egrep '^v[0-9]+\.[0-9]+\.[0-9]+' | tail -1) + ORIGINAL_OPTS="--since-tag $TAG" + ;; +--) + shift + break + ;; +esac +shift +done + +cp CHANGELOG.md /tmp/CHANGELOG.md.$$ +sed -i -n "/^## \[$TAG\]/,\$p" CHANGELOG.md + +github_changelog_generator -u CosmWasm -p cw-plus --base CHANGELOG.md $ORIGINAL_OPTS || cp /tmp/CHANGELOG.md.$$ CHANGELOG.md + +rm -f /tmp/CHANGELOG.md.$$ From 4d34ebdd76c3cc7f9e2122420a45742e899d3ce5 Mon Sep 17 00:00:00 2001 From: Mauro Lacy Date: Fri, 17 Sep 2021 12:01:46 +0200 Subject: [PATCH 04/10] Fix newline --- scripts/update_changelog.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/update_changelog.sh b/scripts/update_changelog.sh index ce49ecb59..860bc38bd 100755 --- a/scripts/update_changelog.sh +++ b/scripts/update_changelog.sh @@ -11,7 +11,7 @@ case $1 in -h|--help) echo -e "Usage: $0 [--since-tag ]\n -h, --help Display help\n - --since-tag Process changes since tag \r + --since-tag Process changes since tag \n -l, --latest-tag Process changes since latest tag" exit 0 ;; From b504dcdc4590376a7246b85bd8e811748cc94d4e Mon Sep 17 00:00:00 2001 From: Mauro Lacy Date: Fri, 17 Sep 2021 12:45:26 +0200 Subject: [PATCH 05/10] Update README --- README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9b6851508..5a8084915 100644 --- a/README.md +++ b/README.md @@ -208,7 +208,9 @@ To generate a changelog we decided to use [github-changelog-generator](https://g To install tool you need Ruby's `gem` package manager. - $ gem install github_changelog_generator + $ gem --user install github_changelog_generator + +And put `$HOME/.gem/ruby/*/bin/` into your PATH. Generating changelog file first time: @@ -218,7 +220,12 @@ Appending next releases could be done adding `--base` flag: $ github_changelog_generator -u CosmWasm -p cw-plus --base CHANGELOG.md -If you hit GitHub's 50 requests/hour limit, please follow [this](https://github.com/github-changelog-generator/github-changelog-generator#github-token) guide to create a token key which you can pass using `--token` flag. +If you hit GitHub's 50 requests/hour limit, please follow [this](https://github.com/github-changelog-generator/github-changelog-generator#github-token) +guide to create a token key which you can pass using `--token` flag. + +There's also a convenience `scripts/update_changelog.sh`, which can take a +--since-tag parameter (to avoid processing the entire history). It can also +auto-detect the latest version tag for you, with --latest-tag. ## Licenses From e89a45466cb34d8ddc1ecce09569a9bdb3c4a181 Mon Sep 17 00:00:00 2001 From: Mauro Lacy Date: Fri, 17 Sep 2021 13:08:12 +0200 Subject: [PATCH 06/10] Honour extra original opts --- scripts/update_changelog.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/update_changelog.sh b/scripts/update_changelog.sh index 860bc38bd..18dcc5bf3 100755 --- a/scripts/update_changelog.sh +++ b/scripts/update_changelog.sh @@ -21,7 +21,7 @@ case $1 in ;; -l|--latest-tag) TAG=$(git tag --sort=creatordate | egrep '^v[0-9]+\.[0-9]+\.[0-9]+' | tail -1) - ORIGINAL_OPTS="--since-tag $TAG" + ORIGINAL_OPTS=$(echo $ORIGINAL_OPTS | sed "s/\B$1\b/--since-tag $TAG/") ;; --) shift From fe39909a181aa30a8ba976f8864c94ac0b2230a0 Mon Sep 17 00:00:00 2001 From: Mauro Lacy Date: Fri, 17 Sep 2021 13:16:28 +0200 Subject: [PATCH 07/10] Fix help / syntax --- scripts/update_changelog.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/update_changelog.sh b/scripts/update_changelog.sh index 18dcc5bf3..da4d75d19 100755 --- a/scripts/update_changelog.sh +++ b/scripts/update_changelog.sh @@ -9,10 +9,10 @@ while true do case $1 in -h|--help) - echo -e "Usage: $0 [--since-tag ]\n - -h, --help Display help\n - --since-tag Process changes since tag \n - -l, --latest-tag Process changes since latest tag" + echo -e "Usage: $0 [-h|--help] [--since-tag ] [-l|--latest-tag] +-h, --help Display help +--since-tag Process changes since tag +-l, --latest-tag Process changes since latest tag" exit 0 ;; --since-tag) @@ -21,7 +21,7 @@ case $1 in ;; -l|--latest-tag) TAG=$(git tag --sort=creatordate | egrep '^v[0-9]+\.[0-9]+\.[0-9]+' | tail -1) - ORIGINAL_OPTS=$(echo $ORIGINAL_OPTS | sed "s/\B$1\b/--since-tag $TAG/") + ORIGINAL_OPTS=$(echo "$ORIGINAL_OPTS" | sed "s/\B$1\b/--since-tag $TAG/") ;; --) shift From ad3d83a21ecdba7caa1e523c843566e3475d9d37 Mon Sep 17 00:00:00 2001 From: Mauro Lacy Date: Fri, 17 Sep 2021 13:19:03 +0200 Subject: [PATCH 08/10] Support --token param --- scripts/update_changelog.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/update_changelog.sh b/scripts/update_changelog.sh index da4d75d19..d33d2f01c 100755 --- a/scripts/update_changelog.sh +++ b/scripts/update_changelog.sh @@ -1,8 +1,8 @@ #!/bin/bash -ORIGINAL_OPTS="$@" -OPTS=$(getopt -l "help,since-tag:,latest-tag" -o "hl" -- "$@") || exit 1 +ORIGINAL_OPTS=$@ +OPTS=$(getopt -l "help,since-tag:,latest-tag,token:" -o "hl" -- "$@") || exit 1 eval set -- "$OPTS" while true From 8b45b900ce0bcbc1d9ba142d0f523450f36a30ed Mon Sep 17 00:00:00 2001 From: Mauro Lacy Date: Fri, 17 Sep 2021 13:26:31 +0200 Subject: [PATCH 09/10] Follow shellcheck when possible --- scripts/update_changelog.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/update_changelog.sh b/scripts/update_changelog.sh index d33d2f01c..b40def043 100755 --- a/scripts/update_changelog.sh +++ b/scripts/update_changelog.sh @@ -1,7 +1,7 @@ #!/bin/bash -ORIGINAL_OPTS=$@ +ORIGINAL_OPTS=$* OPTS=$(getopt -l "help,since-tag:,latest-tag,token:" -o "hl" -- "$@") || exit 1 eval set -- "$OPTS" @@ -20,8 +20,8 @@ case $1 in TAG="$1" ;; -l|--latest-tag) - TAG=$(git tag --sort=creatordate | egrep '^v[0-9]+\.[0-9]+\.[0-9]+' | tail -1) - ORIGINAL_OPTS=$(echo "$ORIGINAL_OPTS" | sed "s/\B$1\b/--since-tag $TAG/") + TAG=$(git tag --sort=creatordate | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+' | tail -1) + ORIGINAL_OPTS=$(echo "$ORIGINAL_OPTS" | sed "s/\\B$1\\b/--since-tag $TAG/") ;; --) shift @@ -32,7 +32,7 @@ shift done cp CHANGELOG.md /tmp/CHANGELOG.md.$$ -sed -i -n "/^## \[$TAG\]/,\$p" CHANGELOG.md +sed -i -n "/^## \\[$TAG\\]/,\$p" CHANGELOG.md github_changelog_generator -u CosmWasm -p cw-plus --base CHANGELOG.md $ORIGINAL_OPTS || cp /tmp/CHANGELOG.md.$$ CHANGELOG.md From e279887be1ea52dd4092854bfba262847082d7f8 Mon Sep 17 00:00:00 2001 From: Mauro Lacy Date: Fri, 17 Sep 2021 13:36:31 +0200 Subject: [PATCH 10/10] Improve help / options --- scripts/update_changelog.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/update_changelog.sh b/scripts/update_changelog.sh index b40def043..62a17f520 100755 --- a/scripts/update_changelog.sh +++ b/scripts/update_changelog.sh @@ -2,17 +2,18 @@ ORIGINAL_OPTS=$* -OPTS=$(getopt -l "help,since-tag:,latest-tag,token:" -o "hl" -- "$@") || exit 1 +OPTS=$(getopt -l "help,since-tag:,latest-tag,token:" -o "hlt" -- "$@") || exit 1 eval set -- "$OPTS" while true do case $1 in -h|--help) - echo -e "Usage: $0 [-h|--help] [--since-tag ] [-l|--latest-tag] + echo -e "Usage: $0 [-h|--help] [--since-tag ] [-l|--latest-tag] [-t|--token ] -h, --help Display help --since-tag Process changes since tag --l, --latest-tag Process changes since latest tag" +-l, --latest-tag Process changes since latest tag +--token Pass changelog github token " exit 0 ;; --since-tag)