Created
July 6, 2016 10:36
-
-
Save RemiEven/7e8cc88fc80d068e9ff181cbc7c8ec78 to your computer and use it in GitHub Desktop.
Fake continuous integration
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/bash | |
# Rémi Even, 06/07/2016 | |
# This script provides a "fake" continuous integration. Rather than using (web)hooks, the target repo fetches the last commit id from origin. If it is different than the local one, it stops the service, updates the local files and restarts the service. | |
function stopService { | |
# Write the code to stop your service here | |
echo "Stopping service" | |
} | |
function startService { | |
# Write the code to start your service here | |
echo "Starting service" | |
} | |
git fetch origin master | |
localCommitHash=$(git rev-parse master) | |
originCommitHash=$(git rev-parse origin/master) | |
if [[ $localCommitHash != $originCommitHash ]]; then | |
stopService | |
git merge origin/master | |
startService | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment