#!/bin/sh
set -e

echo "Deploying application ..."
    # down laravel
    php artisan down
    # Update codebase
    git fetch origin deploy
    git reset --hard origin/deploy
    #composer install
    composer install
    # clear cache
    php artisan optimize:clear
    # cache
    php artisan optimize
    #copy all public folder & index
    cp -rf public/* ~/www
    cp -f index.php.deploy ~/www/index.php
    #up laravel
    php artisan up

echo "Application deployed!"