Last active
August 29, 2015 14:21
-
-
Save NoelDavies/69517c27c5f6cefb9205 to your computer and use it in GitHub Desktop.
Releases Script
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 | |
RELEASES_DIR=~/www/releases | |
SYMLINK_TO=~/www/current | |
CURRENT=`date +%Y%m%d%H%M%S` | |
RELEASE_DIR=$RELEASES_DIR/$CURRENT | |
## Initiate the new release | |
mkdir $RELEASE_DIR | |
cd $RELEASE_DIR | |
hg clone YOUR_REPO_URL . | |
## Custom Post-Clone stuff here | |
# You could have things like | |
# composer install | |
# php artisan cache:routes | |
# etc. | |
## End Custom Post-Clone stuff | |
## Update the current symlink to the current dir | |
ln -nfs $RELEASE_DIR $SYMLINK_TO | |
# Delete oldest dirs, leave latest 5 | |
cd $RELEASES_DIR | |
cd .. | |
rm `ls -t | tail -n +6` -rf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment