From 65a299b7441883be8f0dc1ac51c719fbab901777 Mon Sep 17 00:00:00 2001 From: Andrew Naylor Date: Sun, 21 Feb 2016 12:25:54 +0000 Subject: [PATCH] Add a script to update the version number --- script/release | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100755 script/release diff --git a/script/release b/script/release new file mode 100755 index 0000000..9fd3b62 --- /dev/null +++ b/script/release @@ -0,0 +1,75 @@ +#!/bin/bash -e + +PLIST_FILE="$PWD/mas-cli/mas-cli-Info.plist" + +main() { + VERSION_NUMBER=$(update_version_number) + + git add "$PLIST_FILE" + git commit -eF <(commit_message) + + git tag -a "v${VERSION_NUMBER}" + + echo "Finalise release with: git push --tags" +} + +commit_message() { + cat < $1" >&2 + read -r input + echo "$input" +} + +write_version_number() { + local value + value=$1; shift + write_plist "CFBundleShortVersionString" "${value}" +} + +read_version_number() { + read_plist "CFBundleShortVersionString" +} + +read_plist() { + local key + key=$1; shift + /usr/libexec/PlistBuddy -c "Print :${key}" "${PLIST_FILE}" +} + +write_plist() { + local key + local value + key=$1; shift + value=$1; shift + echo "Setting ${key} to ${value}" >&2 + /usr/libexec/PlistBuddy -c "Set :${key} ${value}" "${PLIST_FILE}" +} + +main