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"
|
2016-05-03 15:19:26 +00:00
|
|
|
RELEASE_VERSION="${VERSION%%-*}"
|
2016-02-17 06:26:35 +00:00
|
|
|
|
|
|
|
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-05-03 15:19:26 +00:00
|
|
|
(cd src/ios && xcrun agvtool new-version "$RELEASE_VERSION")
|
|
|
|
|
|
|
|
# Update CHANGELOG
|
|
|
|
sed -i '' "1s/.*/$RELEASE_VERSION Release notes ($(date '+%Y-%-m-%-d'))/" CHANGELOG.md
|