1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-11-28 11:35:35 +03:00
vimr/bin/build.sh

106 lines
2.9 KiB
Bash
Raw Normal View History

2016-10-14 13:31:51 +03:00
#!/bin/bash
2016-10-14 15:26:14 +03:00
# For jenkins
2016-10-14 13:31:51 +03:00
set -e
2016-10-22 11:06:54 +03:00
# for utf-8 for python script
export LC_CTYPE=en_US.UTF-8
2016-10-14 13:31:51 +03:00
export PATH=/usr/local/bin:$PATH
# # parameters
2016-10-14 15:26:14 +03:00
# - BRANCH
# - IS_SNAPSHOT
# - MARKETING_VERSION
# - RELEASE_NOTES
2016-11-03 22:23:41 +03:00
# - UPDATE_APPCAST
2016-10-14 13:31:51 +03:00
if [ "${IS_SNAPSHOT}" = false ] && [ "${MARKETING_VERSION}" == "" ] ; then
echo "### ERROR If not snapshot, then the marketing version must be set!"
exit 1
fi
2017-04-30 10:45:24 +03:00
if [ "${PUBLISH}" = true ] && [ "${RELEASE_NOTES}" == "" ] ; then
echo "### ERROR No release notes, but publishing to Github!"
exit 1
fi
2016-11-10 17:16:20 +03:00
if [ "${IS_SNAPSHOT}" = false ] && [ "${UPDATE_APPCAST}" = false ] ; then
echo "### ERROR Not updating appcast for release!"
exit 1
fi
2016-11-10 17:16:20 +03:00
if [ "${IS_SNAPSHOT}" = false ] && [ "${BRANCH}" != "master" ] ; then
echo "### ERROR Not building master for release!"
exit 1
fi
2016-11-10 17:16:20 +03:00
if [ "${IS_SNAPSHOT}" = true ] && [ "${BRANCH}" == "master" ] ; then
echo "### ERROR Building master for snapshot!"
exit 1
fi
2016-10-22 11:12:39 +03:00
echo "### Installing some python packages"
2017-08-08 13:30:08 +03:00
pip2 install requests
pip2 install Markdown
2016-10-22 11:12:39 +03:00
2016-10-15 10:38:09 +03:00
echo "### Building VimR"
2016-10-14 13:46:15 +03:00
./bin/prepare_repositories.sh
2016-10-14 13:51:49 +03:00
./bin/clean_old_builds.sh
if [ "${PUBLISH}" = true ] ; then
./bin/set_new_versions.sh ${IS_SNAPSHOT} "${MARKETING_VERSION}"
else
echo "Not publishing => not incrementing the version..."
fi
2016-10-17 23:35:29 +03:00
./bin/build_vimr.sh true
2016-10-14 13:31:51 +03:00
BUNDLE_VERSION=$(agvtool what-version | sed '2q;d' | sed -E 's/ +(.+)/\1/')
MARKETING_VERSION=$(agvtool what-marketing-version | tail -n 1 | sed -E 's/.*of "(.*)" in.*/\1/')
COMPOUND_VERSION="v${MARKETING_VERSION}-${BUNDLE_VERSION}"
2016-10-14 16:58:58 +03:00
TAG=${COMPOUND_VERSION}
2016-12-18 13:24:06 +03:00
2016-10-15 01:09:57 +03:00
if [ "${IS_SNAPSHOT}" = true ] ; then
2016-12-18 13:24:06 +03:00
COMPOUND_VERSION="SNAPSHOT-${BUNDLE_VERSION}"
TAG="snapshot/${BUNDLE_VERSION}"
2016-10-15 01:09:57 +03:00
fi
2016-12-18 13:24:06 +03:00
2017-04-30 11:15:33 +03:00
echo "### Compressing the app"
2016-10-14 16:58:58 +03:00
VIMR_FILE_NAME="VimR-${COMPOUND_VERSION}.tar.bz2"
2017-11-30 00:59:49 +03:00
pushd build/Build/Products/Release
2017-04-30 11:15:33 +03:00
tar cjf ${VIMR_FILE_NAME} VimR.app
popd
2016-10-14 13:31:51 +03:00
2016-10-15 10:38:09 +03:00
echo "### Bundle version: ${BUNDLE_VERSION}"
echo "### Marketing version: ${MARKETING_VERSION}"
echo "### Compund version: ${COMPOUND_VERSION}"
echo "### Tag: ${TAG}"
echo "### VimR archive file name: ${VIMR_FILE_NAME}"
2016-10-14 13:31:51 +03:00
2017-04-30 10:45:24 +03:00
if [ "${PUBLISH}" = false ] ; then
echo "Do not publish => exiting now..."
exit 0
fi
2016-10-15 10:38:09 +03:00
./bin/commit_and_push_tags.sh "${BRANCH}" "${TAG}"
2016-10-24 23:28:48 +03:00
./bin/create_github_release.sh "${COMPOUND_VERSION}" "${TAG}" "${VIMR_FILE_NAME}" "${RELEASE_NOTES}" ${IS_SNAPSHOT}
2016-11-03 22:23:41 +03:00
if [ "${UPDATE_APPCAST}" = true ] ; then
2017-11-30 00:59:49 +03:00
./bin/set_appcast.py "build/Build/Products/Release/${VIMR_FILE_NAME}" "${BUNDLE_VERSION}" "${MARKETING_VERSION}" "${TAG}" ${IS_SNAPSHOT}
./bin/commit_and_push_appcast.sh "${BRANCH}" "${COMPOUND_VERSION}" ${IS_SNAPSHOT} ${UPDATE_SNAPSHOT_APPCAST_FOR_RELEASE}
2016-11-03 22:23:41 +03:00
fi
2016-10-15 10:38:09 +03:00
if [ "${IS_SNAPSHOT}" = false ] ; then
echo "### Merging ${BRANCH} back to develop"
git reset --hard @
git fetch origin
git checkout -b for_master_to_develop origin/develop
git merge --ff-only for_build
git push origin HEAD:develop
fi
2016-10-15 10:38:09 +03:00
echo "### Built VimR"