Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update changelog add upcoming #675

Merged
merged 4 commits into from
Mar 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Changelog

## [Unreleased](https://github.com/CosmWasm/cw-plus/tree/HEAD)

[Full Changelog](https://github.com/CosmWasm/cw-plus/compare/v0.13.0...HEAD)

## [v0.13.0](https://github.com/CosmWasm/cw-plus/tree/v0.13.0) (2022-03-09)

[Full Changelog](https://github.com/CosmWasm/cw-plus/compare/v0.12.1...HEAD)
[Full Changelog](https://github.com/CosmWasm/cw-plus/compare/v0.12.1...0.13.0)

**Breaking changes:**

Expand Down
13 changes: 12 additions & 1 deletion scripts/publish.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
#!/bin/bash
set -o errexit -o nounset -o pipefail
command -v shellcheck > /dev/null && shellcheck "$0"
command -v shellcheck >/dev/null && shellcheck "$0"

function print_usage() {
echo "Usage: $0 [-h|--help]"
echo "Publishes crates to crates.io."
}

if [ "$1" = "-h" ] || [ "$1" = "--help" ]
then
print_usage
exit 1
fi

# this should really more to cosmwasm...
STORAGE_PACKAGES="storage-plus"
Expand Down
10 changes: 5 additions & 5 deletions scripts/set_version.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/bash
set -o errexit -o nounset -o pipefail
command -v shellcheck > /dev/null && shellcheck "$0"
command -v shellcheck >/dev/null && shellcheck "$0"

function print_usage() {
echo "Usage: $0 NEW_VERSION"
echo ""
echo "e.g. $0 0.8.0"
echo "Usage: $0 [-h|--help] <new_version>"
echo "e.g.: $0 0.8.0"
}

if [ "$#" -ne 1 ]; then
if [ "$#" -ne 1 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]
then
print_usage
exit 1
fi
Expand Down
38 changes: 30 additions & 8 deletions scripts/update_changelog.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
#!/bin/bash

set -o errexit -o pipefail

ORIGINAL_OPTS=$*
OPTS=$(getopt -l "help,since-tag:,full,token:" -o "hft" -- "$@") || exit 1
OPTS=$(getopt -l "help,since-tag:,upcoming-tag:,full,token:" -o "hu:ft" -- "$@") || exit 1

function print_usage() {
echo -e "Usage: $0 [-h|--help] [-f|--full] [--since-tag <tag>] [-u|--upcoming-tag] <tag> [-t|--token <token>]
-h, --help Display help
-f, --full Process changes since the beginning (by default: since latest git version tag)
--since-tag <tag> Process changes since git version tag <tag> (by default: since latest git version tag)
-u, --upcoming-tag <tag> Add a <tag> title in CHANGELOG for the new changes
--token <token> Pass changelog github token <token>"
}

function remove_opt() {
ORIGINAL_OPTS=$(echo "$ORIGINAL_OPTS" | sed "s/\\B$1\\b//")
}

eval set -- "$OPTS"
while true
do
case $1 in
-h|--help)
echo -e "Usage: $0 [-h|--help] [-f|--full] [--since-tag <tag>] [-t|--token <token>]
-h, --help Display help
-f, --full Process changes since the beginning (by default: since latest git version tag)
--since-tag <tag> Process changes since git version tag <tag> (by default: since latest git version tag)
--token <token> Pass changelog github token <token>"
print_usage
exit 0
;;
--since-tag)
Expand All @@ -22,7 +31,13 @@ case $1 in
;;
-f|--full)
TAG="<FULL>"
ORIGINAL_OPTS=$(echo "$ORIGINAL_OPTS" | sed "s/\\B$1\\b//")
remove_opt $1
;;
-u|--upcoming-tag)
remove_opt $1
shift
UPCOMING_TAG="$1"
remove_opt $1
;;
--)
shift
Expand Down Expand Up @@ -50,4 +65,11 @@ 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

if [ -n "$UPCOMING_TAG" ]
then
# Add "upcoming" version tag
TODAY=$(date "+%Y-%m-%d")
sed -i "s+\[Full Changelog\](https://github.com/CosmWasm/cw-plus/compare/\(.*\)\.\.\.HEAD)+[Full Changelog](https://github.com/CosmWasm/cw-plus/compare/$UPCOMING_TAG...HEAD)\n\n## [$UPCOMING_TAG](https://github.com/CosmWasm/cw-plus/tree/$UPCOMING_TAG) ($TODAY)\n\n[Full Changelog](https://github.com/CosmWasm/cw-plus/compare/\1...$UPCOMING_TAG)+" CHANGELOG.md
fi
Comment on lines +72 to +73
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an idea, you could try to add some validator here that sed actually worked (in case anything happens and for example changelog format slightly changes)

Copy link
Contributor Author

@maurolacy maurolacy Mar 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's an ugly line indeed. If I enable shellcheck here, which I tried, it complains about many issues with this script, and with abundant whining on this line in particular.

Will try to improve on it. Perhaps adding shellcheck, fixing some stuff, and silencing some other warnings.

On the other hand, if sed fails to match here (basically because there's no ...HEAD tag in the changelog, nothing happens.


rm -f /tmp/CHANGELOG.md.$$