Skip to content

Instantly share code, notes, and snippets.

@simbas
Last active December 3, 2018 16:36
Show Gist options
  • Save simbas/4f313f285b05f559e9e27763d85b4a3a to your computer and use it in GitHub Desktop.
Save simbas/4f313f285b05f559e9e27763d85b4a3a to your computer and use it in GitHub Desktop.
prepareNextIteration.sh
#!/usr/bin/env bash
# env vars:
# BRANCH = target branch name
# FRONT_VERSION = infra-front version (entcore in package.json)
# BACK_VERSION = entcore version
#
# usage:
# # in the root folder of an app repository
# BRANCH="v3.3" FRONT_VERSION="~3.3.0-dev" BACK_VERSION="3.3-SNAPSHOT" ~/bin/prepareNextIteration.sh
if [ -z "$BRANCH" ]; then
echo "Need to set BRANCH"
exit 1
fi
if [ -z "$FRONT_VERSION" ]; then
echo "Need to set FRONT_VERSION"
exit 1
fi
if [ -z "$BACK_VERSION" ]; then
echo "Need to set BACK_VERSION"
exit 1
fi
git fetch
git checkout origin/dev
git checkout -b ${BRANCH}
echo ""
echo "$(cat gradle.properties | grep ^version)"
echo ""
echo "* what is the next version of the app?"
read APP_VERSION
echo ""
echo "$(cat deployment/*/conf.json.template | grep \"name\")"
echo ""
echo "* what is the deployment name of the app?"
read DEPLOYMENT_VERSION
sed -e "s|\"entcore\": \".*\"|\"entcore\": \"${FRONT_VERSION}\"|g" -i package.json
sed -e "s|entCoreVersion=.*|entCoreVersion=${BACK_VERSION}|g" -i gradle.properties
sed -e "s|version=.*|version=${APP_VERSION}|g" -i gradle.properties
sed -e "s|\"name\": \".*\"|\"name\": \"${DEPLOYMENT_VERSION}\"|g" -i deployment/*/conf.json.template
git commit -a -m "prepare next development iteration"
echo ""
echo "to check before pushing:"
echo "git diff HEAD^"
echo "to push:"
echo "git push --set-upstream origin ${BRANCH}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment