Last active
January 22, 2023 09:08
Revisions
-
philipborbon renamed this gist
Jan 22, 2023 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
philipborbon revised this gist
Jun 3, 2022 . No changes.There are no files selected for viewing
-
philipborbon created this gist
Jun 3, 2022 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ #!/bin/bash TARGET="/home/user/project" GIT_DIR="/home/user/project.git" BRANCH="master" while read oldrev newrev ref do # only checking out the master (or whatever branch you would like to deploy) if [ "$ref" = "refs/heads/$BRANCH" ]; then echo "Ref $ref received. Deploying ${BRANCH} branch to production..." git --work-tree=$TARGET --git-dir=$GIT_DIR checkout -f $BRANCH # chmod +x $TARGET/reload.sh php /usr/local/bin/composer install --optimize-autoloader --no-dev --working-dir=$TARGET php $TARGET/artisan config:cache php $TARGET/artisan route:cache php $TARGET/artisan view:cache php $TARGET/artisan queue:restart else echo "Ref $ref received. Doing nothing: only the ${BRANCH} branch may be deployed on this server." fi done