Skip to content

Instantly share code, notes, and snippets.

@naimkhalifa
Created June 12, 2017 15:57
Show Gist options
  • Save naimkhalifa/8863a6202b0c010f9a547a5c4f79b92b to your computer and use it in GitHub Desktop.
Save naimkhalifa/8863a6202b0c010f9a547a5c4f79b92b to your computer and use it in GitHub Desktop.

Revisions

  1. naimkhalifa created this gist Jun 12, 2017.
    22 changes: 22 additions & 0 deletions post-receive
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    #!/bin/bash
    working_dir_base="/homez.172/nomdutilisateur/www/_sites/monsite.git"

    while read oldrev newrev refname
    do
    branch=$(git rev-parse --symbolic --abbrev-ref $refname)

    echo "Starting deployment..."

    GIT_WORK_TREE=$working_dir_base git checkout $branch -f
    NOW=$(date +"%Y%m%d-%H%M")
    git tag release_$NOW $branch

    echo " /==============================="
    echo " | Target branch: $branch"
    echo " | Target folder: $working_dir_base"
    echo " \=============================="

    echo "done !"
    done

    #more info at http://www.codeur.co/configurer-git-pour-d%C3%A9ployer-sur-un-mutualis%C3%A9-ovh (fr)