Last active
February 16, 2016 19:41
-
-
Save torniker/9037d147d0582ca9777b to your computer and use it in GitHub Desktop.
script for retrieving and building laravel project from github
This file contains hidden or 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 | |
export DATE=$(date +%Y-%m-%d-%H-%M) | |
export CURDIR=$(readlink -f /home/user/current) | |
cd /home/user/deploy/files && wget -O projectmaster.zip -q https://github.com/username/repository/archive/master.zip | |
# Second, unzip it, if the zip file exists | |
if [ -f /home/user/deploy/files/projectmaster.zip ]; then | |
unzip -q /home/user/deploy/files/projectmaster.zip | |
# Delete zip file | |
rm /home/user/deploy/files/projectmaster.zip | |
mv project-master /home/user/$DATE | |
# this is for faster deployment | |
ln -s /home/user/vendor /home/user/$DATE/vendor | |
ln -s /home/user/storage /home/user/$DATE/storage | |
ln -s /home/user/.env /home/user/$DATE/.env | |
# you can also have node_modules or bower_compnents or anything you like | |
cd /home/user/$DATE && sudo composer install | |
# do some tasks required for deployment like | |
# npm install | |
# or build your js / less / sass files | |
# or migrations | |
# or set owner/permissions | |
# or any other tasks need to be done before deploy | |
# when all is done just switch the link of current directory | |
ln -sfT /home/user/$DATE /home/user/current | |
# if you want to remove old version of the project uncomment following line | |
# rm -rf $CURDIR | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment