Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
## post-receive | ||
|
||
This is run on the remote when pushing after the all refs have been updated. It does not take parameters, but receives info through stdin in the form of "<old-value> <new-value> <ref-name>". Because it is called after the updates, it cannot abort the process. | ||
|
||
## invoked by | ||
|
||
```bash | ||
git-receive-pack | ||
# on the remote repo | ||
``` | ||
|
||
## post-receive git hooks for: | ||
|
||
* [post-receive-specific-folder](https://github.com/aitemr/awesome-git-hooks/blob/master/post-receive/post-receive-specific-folder) - hook to deploy the code being pushed to production branch to a specific folder | ||
|
||
## support | ||
|
||
If you have a question, find a bug, or just want to say hi, please open an [issue on GitHub](https://github.com/aitemr/awesome-git-hooks/issues/new) | ||
|
||
## license | ||
|
||
[![CC0](http://mirrors.creativecommons.org/presskit/buttons/88x31/svg/cc-zero.svg)](https://creativecommons.org/publicdomain/zero/1.0/) | ||
|
||
To the extent possible under law, [Islam Temirbek](https://aitemr.github.io) has waived all copyright and related or neighboring rights to this work. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/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 | ||
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 |