Created
January 19, 2018 00:11
-
-
Save mbarcia/5eebbe2038c98da818e35e680fbfe1c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Note: ~/.ssh/environment should not be used, as it | |
# already has a different purpose in SSH. | |
env="$HOME/.ssh-agent" | |
# Note: Don't bother checking SSH_AGENT_PID. It's not used | |
# by SSH itself, and it might even be incorrect | |
# (for example, when using agent-forwarding over SSH). | |
agent_is_running() { | |
if [ "$SSH_AUTH_SOCK" ]; then | |
# ssh-add returns: | |
# 0 = agent running, has keys | |
# 1 = agent running, no keys | |
# 2 = agent not running | |
ssh-add -l >/dev/null 2>&1 || [ $? -eq 1 ] | |
else | |
false | |
fi | |
} | |
agent_has_keys() { | |
ssh-add -l >/dev/null 2>&1 | |
} | |
agent_load_env() { | |
if [ -f "$env" ]; then | |
. "$env" >/dev/null | |
fi | |
} | |
agent_start() { | |
(umask 077; ssh-agent >"$env") | |
. "$env" >/dev/null | |
} | |
if ! agent_is_running; then | |
agent_load_env | |
fi | |
# if your keys are not stored in ~/.ssh/id_rsa or ~/.ssh/id_dsa, you'll need | |
# to paste the proper path after ssh-add | |
if ! agent_is_running; then | |
agent_start | |
ssh-add | |
elif ! agent_has_keys; then | |
ssh-add | |
fi | |
unset env | |
if [ "$1" == "" ]; then | |
echo "Give me one tag!" | |
read TAG | |
else | |
TAG=$1 | |
fi | |
echo "About to tag Drupsible projects with $TAG, confirm yes" | |
read CONFIRM | |
if [ "$CONFIRM" != "yes" ]; then | |
echo "NOT confirmed, see you later!" | |
exit 0 | |
fi | |
PROJECTS=(drupsible-apache \ | |
drupsible-composer \ | |
drupsible-controller \ | |
drupsible-deploy \ | |
drupsible-drupal-console \ | |
drupsible-drush \ | |
drupsible-memcached \ | |
drupsible-mysql \ | |
ansible-php \ | |
ansible-newrelic \ | |
drupsible-uploadprogress \ | |
drupsible-varnish \ | |
drupsible-xdebug \ | |
drupsible-twigc \ | |
drupsible-samba) | |
cd ~/git | |
for i in ${PROJECTS[@]}; do | |
cd "${i}" | |
if [ "$?" == 0 ]; then | |
GIT_STATUS=$(git status | grep "On branch master") | |
if [ "${GIT_STATUS}" == "On branch master" ]; then | |
git checkout -b "hotfix/${TAG}" | |
if [ "${i}" == "drupsible-controller" ]; then | |
sed -i "s|version: master| version: ${TAG}|g" ansible/requirements.default.yml | |
git commit --signoff -m "Versions of all the Drupsible roles have been fixed to ${TAG}" ansible/requirements.default.yml | |
fi | |
git push origin "hotfix/${TAG}" | |
git tag -s -a "${TAG}" -m "Part of Drupsible $TAG" | |
git tag -v "${TAG}" | |
git push origin "${TAG}" | |
git checkout master | |
fi | |
cd - | |
fi | |
done | |
exit 0 | |
echo "Drupsible projects tagged with $TAG. YAY!. Don't forget to tag drupsible-vm manually if needed." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment