From 1d8df48d74b2243dde23cfbc303b1d4ae5f10dd2 Mon Sep 17 00:00:00 2001 From: Oscar Campos Date: Tue, 16 Aug 2016 23:43:13 +0100 Subject: [PATCH] added release script --- release.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 release.sh diff --git a/release.sh b/release.sh new file mode 100755 index 00000000..35e7fa91 --- /dev/null +++ b/release.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +last_version=`git describe | awk -F'-' '{print $1}'` +normalized_last_version=$(echo "${last_version}" | awk '{gsub("v", ""); print $1}') + +echo "Give me the new version for this reelase (latest ${last_version})..." +read new_version +normalized_version=$(echo "${new_version}" | awk '{gsub("v", ""); print $1}') + +echo "Updating version information to ${new_version} latest ${last_version}..." +echo "Give me a version description: (Ctrl+C to cancel)" +read verdesc + +# create a new version file in messages directory +echo "Give me the version notes to publish in the messages and release (end with '%')..." +read -d '%' version_notes +echo "$version_notes" > ./messages/$normalized_version.txt + +# modify messages.json to reflect the new version +numlines=$(wc -l ./messages.json | awk '{print $1}') +head -n $(($numlines - 2)) ./messages.json > ./messages.json.tmp +mv ./messages.json.tmp ./messages.json +echo " \"$normalized_last_version\": \"messages/$normalized_last_version.txt\"," >> ./messages.json +echo " \"$normalized_version\": \"messages/$normalized_version.txt\"" >> ./messages.json +echo "}" >> ./messages.json +cat ./messages.json | json_verify -q || error "invalid JSON in messages.json" + +# no errors continue with the commits +git add ./messages/$normalized_version.txt ./messages.json +git commit -m "Updated version from $last_version to $new_version" +git tag -a $new_version -m "$verdesc" +echo "git tag $new_version created, ready to push..." + +function error { + echo "error: $1" + exit 1 +}