Commit 4b3e1ea0 authored by Dominik Charousset's avatar Dominik Charousset

Update changelog and release script

parent 5ead6f95
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
All notable changes to this project will be documented in this file. The format All notable changes to this project will be documented in this file. The format
is based on [Keep a Changelog](https://keepachangelog.com). is based on [Keep a Changelog](https://keepachangelog.com).
## [0.18.0] - Unreleased ## [0.18.0-rc.1] - 2020-09-09
### Added ### Added
...@@ -519,7 +519,7 @@ is based on [Keep a Changelog](https://keepachangelog.com). ...@@ -519,7 +519,7 @@ is based on [Keep a Changelog](https://keepachangelog.com).
- Setting the log level to `quiet` now properly suppresses any log output. - Setting the log level to `quiet` now properly suppresses any log output.
- Configuring colored terminal output should now print colored output. - Configuring colored terminal output should now print colored output.
[0.18.0]: https://github.com/actor-framework/actor-framework/compare/0.17.3...master [0.18.0-rc.1]: https://github.com/actor-framework/actor-framework/releases/0.18.0-rc.1
[0.17.7]: https://github.com/actor-framework/actor-framework/compare/0.17.6...release/0.17 [0.17.7]: https://github.com/actor-framework/actor-framework/compare/0.17.6...release/0.17
[0.17.6]: https://github.com/actor-framework/actor-framework/releases/0.17.6 [0.17.6]: https://github.com/actor-framework/actor-framework/releases/0.17.6
[0.17.5]: https://github.com/actor-framework/actor-framework/releases/0.17.5 [0.17.5]: https://github.com/actor-framework/actor-framework/releases/0.17.5
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
set -e set -e
usage_string="\ usage_string="\
Usage: $0 VERSION Usage: $0 [--rc=NUM] VERSION
" "
function usage() { function usage() {
...@@ -74,6 +74,25 @@ function ask_permission() { ...@@ -74,6 +74,25 @@ function ask_permission() {
fi fi
} }
rc_version=""
# Parse user input.
while [[ "$1" =~ ^-- ]]; do
case "$1" in
--*=*) optarg=$(echo "$1" | sed 's/[-_a-zA-Z0-9]*=//') ;;
esac
case "$1" in
--rc=*)
rc_version=$optarg
;;
*)
raise_error "unrecognized CLI option"
;;
esac
shift
done
if [ $# -ne 1 ] ; then if [ $# -ne 1 ] ; then
usage usage
fi fi
...@@ -124,18 +143,30 @@ assert_exists "$token_path" "$config_hpp_path" "$github_msg" ...@@ -124,18 +143,30 @@ assert_exists "$token_path" "$config_hpp_path" "$github_msg"
# check for a clean state # check for a clean state
assert_exists_not .make-release-steps.bash assert_exists_not .make-release-steps.bash
assert_git_status_clean "." # assert_git_status_clean "."
if [ ! -f "$blog_msg" ]; then if [ ! -f "$blog_msg" ]; then
ask_permission "$blog_msg missing, continue without blog post [y] or abort [n]?" ask_permission "$blog_msg missing, continue without blog post [y] or abort [n]?"
else else
# target files # target files
assert_exists "$blog_posts_path" assert_exists "$blog_posts_path"
if [ -z "$rc_version" ]; then
blog_release_version="$1"
else
blog_release_version="$1-rc.$rc_version"
fi
blog_target_file="$blog_posts_path/$(date +%F)-version-$1-released.md" blog_target_file="$blog_posts_path/$(date +%F)-version-$1-released.md"
assert_exists_not "$blog_target_file" assert_exists_not "$blog_target_file"
assert_git_status_clean "../blog/" assert_git_status_clean "../blog/"
fi fi
# add scaffold for release script
echo "\
#!/bin/bash
set -e
" > .make-release-steps.bash
# convert major.minor.patch version given as first argument into JJIIPP with: # convert major.minor.patch version given as first argument into JJIIPP with:
# JJ: two-digit (zero padded) major version # JJ: two-digit (zero padded) major version
# II: two-digit (zero padded) minor version # II: two-digit (zero padded) minor version
...@@ -145,17 +176,31 @@ version_str=$(echo "$1" | awk -F. '{ if ($1 > 0) printf("%d%02d%02d\n", $1, $2, ...@@ -145,17 +176,31 @@ version_str=$(echo "$1" | awk -F. '{ if ($1 > 0) printf("%d%02d%02d\n", $1, $2,
echo ">>> patching config.hpp" echo ">>> patching config.hpp"
sed "s/#define CAF_VERSION [0-9]*/#define CAF_VERSION ${version_str}/g" < "$config_hpp_path" > .tmp_conf_hpp sed "s/#define CAF_VERSION [0-9]*/#define CAF_VERSION ${version_str}/g" < "$config_hpp_path" > .tmp_conf_hpp
mv .tmp_conf_hpp "$config_hpp_path"
echo ; echo # check whether the version actually changed
echo ">>> please review the diff reported by Git for patching config.hpp:" if cmp --silent .tmp_conf_hpp "$config_hpp_path" ; then
git diff rm .tmp_conf_hpp
echo ; echo ask_permission "version already matches in config.hpp, continue pushing tag [y] or abort [n]?"
ask_permission "type [n] to abort or [y] to proceed" else
mv .tmp_conf_hpp "$config_hpp_path"
echo ; echo
echo ">>> please review the diff reported by Git for patching config.hpp:"
git diff
echo ; echo
ask_permission "type [n] to abort or [y] to proceed"
echo "\
git commit -a -m \"Change version to $1\"
" >> .make-release-steps.bash
fi
# piping through AWK/printf makes sure 0.15 is expanded to 0.15.0 # piping through AWK/printf makes sure 0.15 is expanded to 0.15.0
tag_version=$(echo "$1" | awk -F. '{ printf("%d.%d.%d", $1, $2, $3) }') tag_version=$(echo "$1" | awk -F. '{ printf("%d.%d.%d", $1, $2, $3) }')
if [ -n "$rc_version" ]; then
tag_version="$tag_version-rc.$rc_version"
fi
token=$(cat "$token_path") token=$(cat "$token_path")
tag_descr=$(awk 1 ORS='\\r\\n' "$github_msg") tag_descr=$(awk 1 ORS='\\r\\n' "$github_msg")
github_json=$(printf '{"tag_name": "%s","name": "%s","body": "%s","draft": false,"prerelease": false}' "$tag_version" "$tag_version" "$tag_descr") github_json=$(printf '{"tag_name": "%s","name": "%s","body": "%s","draft": false,"prerelease": false}' "$tag_version" "$tag_version" "$tag_descr")
...@@ -164,21 +209,20 @@ github_json=$(printf '{"tag_name": "%s","name": "%s","body": "%s","draft": false ...@@ -164,21 +209,20 @@ github_json=$(printf '{"tag_name": "%s","name": "%s","body": "%s","draft": false
anchor="$PWD" anchor="$PWD"
echo "\ echo "\
#!/bin/bash
set -e
git commit -a -m \"Change version to $1\"
git push git push
git tag $tag_version git tag $tag_version
git push origin --tags git push origin --tags
curl --data '$github_json' https://api.github.com/repos/actor-framework/actor-framework/releases?access_token=$token curl --data '$github_json' https://api.github.com/repos/actor-framework/actor-framework/releases?access_token=$token
" > .make-release-steps.bash " >> .make-release-steps.bash
if which brew &>/dev/null ; then if [ -z "$rc_version" ]; then
file_url="https://github.com/actor-framework/actor-framework/archive/$tag_version.tar.gz" if which brew &>/dev/null ; then
echo "\ file_url="https://github.com/actor-framework/actor-framework/archive/$tag_version.tar.gz"
echo "\
export HOMEBREW_GITHUB_API_TOKEN=\$(cat "$token_path") export HOMEBREW_GITHUB_API_TOKEN=\$(cat "$token_path")
brew bump-formula-pr --message=\"Update CAF to version $tag_version\" --url=\"$file_url\" caf brew bump-formula-pr --message=\"Update CAF to version $tag_version\" --url=\"$file_url\" caf
" >> .make-release-steps.bash " >> .make-release-steps.bash
fi
fi fi
if [ -f "$blog_msg" ]; then if [ -f "$blog_msg" ]; then
...@@ -186,14 +230,14 @@ if [ -f "$blog_msg" ]; then ...@@ -186,14 +230,14 @@ if [ -f "$blog_msg" ]; then
cp "$blog_msg" "$blog_target_file" cp "$blog_msg" "$blog_target_file"
cd ../blog cd ../blog
git add _posts git add _posts
git commit -m \"$1 announcement\" git commit -m \"$tag_version announcement\"
git push git push
cd "$anchor" cd "$anchor"
" >> .make-release-steps.bash " >> .make-release-steps.bash
fi fi
echo ; echo echo ; echo
echo ">>> please review the final steps for releasing $1" echo ">>> please review the final steps for releasing $tag_version "
cat .make-release-steps.bash cat .make-release-steps.bash
echo ; echo echo ; echo
ask_permission "type [y] to execute the steps above or [n] to abort" ask_permission "type [y] to execute the steps above or [n] to abort"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment