Skip to content

Commit

Permalink
chore(update/bump-version.sh): automate assisted release flow
Browse files Browse the repository at this point in the history
  • Loading branch information
lotem committed Jun 22, 2019
1 parent 562533b commit 24a1f06
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions update/bump-version.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
#!/bin/bash

set -e

invalid_args() {
echo "Usage: $(basename $0) <old_version> <new_version>|major|minor|patch"
exit 1
}

match_line() {
grep --quiet --fixed-strings "$@"
}

version_pattern='([0-9]+)\.([0-9]+)\.([0-9]+)'

old_version=$1
Expand Down Expand Up @@ -41,7 +47,18 @@ else
invalid_args
fi

echo "updating ${old_major}.${old_minor}.${old_patch} => ${new_major}.${new_minor}.${new_patch}"
# verify old_version is current version.
match_line "WEASEL_VERSION_STR \"${old_version}\"" include/WeaselVersion.h &&
match_line "WEASEL_VERSION=${old_version}" build.bat &&
match_line "version: ${old_version}" appveyor.yml || (
echo >&2 "${old_version} doesn't match current version."
exit 1
)

old_version="${old_major}.${old_minor}.${old_patch}"
new_version="${new_major}.${new_minor}.${new_patch}"
echo "updating ${old_version} => ${new_version}"


if [[ $OSTYPE =~ darwin ]]; then
L_BOUND='[[:<:]]'
Expand Down Expand Up @@ -96,4 +113,15 @@ edit_source_file update/appcast.xml
update_pub_date update/testing-appcast.xml
update_pub_date update/appcast.xml

update_changelog "${new_major}.${new_minor}.${new_patch}"
update_changelog "${new_version}"
${VISUAL:-${EDITOR:-vim}} CHANGELOG.md
match_line "## ${new_version} " CHANGELOG.md || (
echo >&2 "CHANGELOG.md has no changes for version ${new_version}."
exit 1
)
bash update/write-release-notes.sh

release_message="chore(release): ${new_version} :tada:"
release_tag="${new_version}"
git commit --all --message "${release_message}"
git tag --annotate "${release_tag}" --message "${release_message}"

0 comments on commit 24a1f06

Please sign in to comment.