#!/bin/sh

set -e

BUILT_PRODUCTS_DIR=$1
VERSION=$2
PLIST_PATH="$BUILT_PRODUCTS_DIR/Nylas.app/Contents/Info.plist"
HELPER_PLIST_PATH="$BUILT_PRODUCTS_DIR/Nylas.app/Contents/Frameworks/Atom Helper.app/Contents/Info.plist"

# Update version
/usr/libexec/PlistBuddy -c "Set CFBundleShortVersionString $VERSION" "$PLIST_PATH"
/usr/libexec/PlistBuddy -c "Set CFBundleVersion $VERSION" "$PLIST_PATH"
/usr/libexec/PlistBuddy -c "Set CFBundleShortVersionString $VERSION" "$HELPER_PLIST_PATH"
/usr/libexec/PlistBuddy -c "Set CFBundleVersion $VERSION" "$HELPER_PLIST_PATH"
