2016-02-17 06:26:35 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
set -o pipefail
|
|
|
|
|
2016-03-23 22:30:46 +00:00
|
|
|
if [ "$1" = '--force' ]; then
|
|
|
|
FORCE=true
|
|
|
|
shift
|
|
|
|
else
|
|
|
|
FORCE=false
|
|
|
|
fi
|
|
|
|
|
2016-02-17 06:26:35 +00:00
|
|
|
VERSION="$1"
|
|
|
|
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
|
|
|
|
# Check that the version looks semver compliant.
|
2016-03-16 18:19:09 +00:00
|
|
|
if ! node_modules/.bin/semver "$VERSION" > /dev/null; then
|
2016-02-17 06:26:35 +00:00
|
|
|
echo "Invalid version number: $VERSION" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2016-03-23 22:30:46 +00:00
|
|
|
# Update the version in package.json (unless --force and version is unchanged).
|
|
|
|
if ! $FORCE || [ "$VERSION" != "$(npm --silent run get-version)" ]; then
|
|
|
|
npm --no-git-tag-version version "$VERSION"
|
|
|
|
fi
|
2016-02-17 06:26:35 +00:00
|
|
|
|
|
|
|
# Update CURRENT_PROJECT_VERSION and DYLIB_CURRENT_VERSION in the Xcode project.
|
2016-03-23 22:30:46 +00:00
|
|
|
cd src/ios
|
2016-03-16 18:19:09 +00:00
|
|
|
xcrun agvtool new-version "${VERSION%%-*}"
|