Skip to content

Instantly share code, notes, and snippets.

@mikaelz
Forked from lemiorhan/post-receive
Created June 19, 2016 05:27
Show Gist options
  • Select an option

  • Save mikaelz/50d56c86d8ebfce5c2feb526ebaab01b to your computer and use it in GitHub Desktop.

Select an option

Save mikaelz/50d56c86d8ebfce5c2feb526ebaab01b to your computer and use it in GitHub Desktop.

Revisions

  1. @lemiorhan lemiorhan revised this gist Feb 11, 2014. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions post-receive
    Original file line number Diff line number Diff line change
    @@ -7,11 +7,16 @@ while read oldrev newrev refname
    do
    branch=$(git rev-parse --symbolic --abbrev-ref $refname)
    if [ -n "$branch" ] && [ "$target_branch" == "$branch" ]; then

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

    echo " /==============================="
    echo " | DEPLOYMENT COMPLETED"
    echo " | Target branch: $target_branch"
    echo " | Target folder: $working_tree"
    echo " | Tag name : release_$NOW"
    echo " \=============================="
    fi
    done
  2. @lemiorhan lemiorhan created this gist Feb 10, 2014.
    17 changes: 17 additions & 0 deletions post-receive
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    #!/bin/bash

    target_branch="production"
    working_tree="PATH_TO_DEPLOY"

    while read oldrev newrev refname
    do
    branch=$(git rev-parse --symbolic --abbrev-ref $refname)
    if [ -n "$branch" ] && [ "$target_branch" == "$branch" ]; then
    GIT_WORK_TREE=$working_tree git checkout $target_branch -f
    echo " /==============================="
    echo " | DEPLOYMENT COMPLETED"
    echo " | Target branch: $target_branch"
    echo " | Target folder: $working_tree"
    echo " \=============================="
    fi
    done