|
| 1 | +# Git hook deployment made for Laravel |
| 2 | + |
| 3 | +[![Latest Version on Packagist][ico-version]][link-packagist] |
| 4 | +[![Software License][ico-license]](LICENSE.md) |
| 5 | +[![Build Status][ico-travis]][link-travis] |
| 6 | +[![Total Downloads][ico-downloads]][link-downloads] |
| 7 | + |
| 8 | +## Install |
| 9 | + |
| 10 | +Via Composer |
| 11 | + |
| 12 | +``` bash |
| 13 | +$ composer require webklex/laravel-git-hook |
| 14 | +``` |
| 15 | + |
| 16 | +## Setup |
| 17 | + |
| 18 | +Add the service provider to the providers array in `config/app.php`. |
| 19 | + |
| 20 | +``` php |
| 21 | +'providers' => [ |
| 22 | + Webklex\GitHook\Providers\LaravelServiceProvider::class, |
| 23 | +]; |
| 24 | +``` |
| 25 | + |
| 26 | +## Publishing |
| 27 | + |
| 28 | +You can publish everything at once |
| 29 | + |
| 30 | +``` php |
| 31 | +php artisan vendor:publish --provider="Webklex\GitHook\Providers\LaravelServiceProvider" |
| 32 | +``` |
| 33 | + |
| 34 | +or you can publish groups individually. |
| 35 | + |
| 36 | +``` php |
| 37 | +php artisan vendor:publish --provider="Webklex\GitHook\Providers\LaravelServiceProvider" --tag="config" |
| 38 | +``` |
| 39 | + |
| 40 | +## Usage |
| 41 | + |
| 42 | +This library is designed to handle the automatic deployment by git hooks |
| 43 | +as simple as possible. There isn't much todo to get started: just add the |
| 44 | +Provider and edit the `config/git-hook.php` file to make it fit your needs. |
| 45 | + |
| 46 | + |
| 47 | +Custom configuration can be made within the config/git-hook.php file: |
| 48 | +``` |
| 49 | +/* |
| 50 | +|-------------------------------------------------------------------------- |
| 51 | +| Email recipients |
| 52 | +|-------------------------------------------------------------------------- |
| 53 | +| |
| 54 | +| The email address and name that notification emails will be sent to. |
| 55 | +| Leave the array empty to disable emails. |
| 56 | +| |
| 57 | +| [ |
| 58 | +| ['name' => 'Admin', 'address' => '[email protected]'], |
| 59 | +| ... |
| 60 | +| ] |
| 61 | +| |
| 62 | +*/ |
| 63 | +'email_recipients' => [], |
| 64 | + |
| 65 | + |
| 66 | +/* |
| 67 | +|-------------------------------------------------------------------------- |
| 68 | +| Email sender |
| 69 | +|-------------------------------------------------------------------------- |
| 70 | +| |
| 71 | +| The email address and name that notification emails will be sent from. |
| 72 | +| This will default to the sender in config(mail.from) if left null. |
| 73 | +| |
| 74 | +*/ |
| 75 | +'email_sender' => ['address' => null, 'name' => null], |
| 76 | + |
| 77 | + |
| 78 | +/* |
| 79 | +|-------------------------------------------------------------------------- |
| 80 | +| Repository path |
| 81 | +|-------------------------------------------------------------------------- |
| 82 | +| |
| 83 | +| This the root path of the Git repository that will be pulled. If this |
| 84 | +| is left empty the script will try to determine the directory itself |
| 85 | +| but looking for the project's .env file it's nearby .git directory. |
| 86 | +| |
| 87 | +| No trailing slash |
| 88 | +| |
| 89 | +*/ |
| 90 | +'repo_path' => '', |
| 91 | + |
| 92 | + |
| 93 | +/* |
| 94 | +|-------------------------------------------------------------------------- |
| 95 | +| Allowed sources |
| 96 | +|-------------------------------------------------------------------------- |
| 97 | +| |
| 98 | +| A request will be ignored unless it comes from an IP listed in this |
| 99 | +| array. Leave the array empty to allow all sources. |
| 100 | +| |
| 101 | +| This is useful for a little extra security if you run your own Git |
| 102 | +| repo server. |
| 103 | +| |
| 104 | +*/ |
| 105 | +'allowed_sources' => [], |
| 106 | + |
| 107 | + |
| 108 | +/* |
| 109 | +|-------------------------------------------------------------------------- |
| 110 | +| Remote name |
| 111 | +|-------------------------------------------------------------------------- |
| 112 | +| |
| 113 | +| The name of the remote repository to pull the changes from |
| 114 | +| |
| 115 | +*/ |
| 116 | +'remote' => 'origin', |
| 117 | + |
| 118 | + |
| 119 | +/* |
| 120 | +|-------------------------------------------------------------------------- |
| 121 | +| Git binary path |
| 122 | +|-------------------------------------------------------------------------- |
| 123 | +| |
| 124 | +| The full path to the system git binary. e.g. /usr/bin/git |
| 125 | +| |
| 126 | +| Leave blank to let the system detect using the current PATH variable |
| 127 | +| |
| 128 | +*/ |
| 129 | +'git_path' => '', |
| 130 | + |
| 131 | + |
| 132 | +/* |
| 133 | +|-------------------------------------------------------------------------- |
| 134 | +| Logger file name |
| 135 | +|-------------------------------------------------------------------------- |
| 136 | +| |
| 137 | +| The filename of the logfile which will be used to store deployment |
| 138 | +| information. |
| 139 | +| |
| 140 | +| By default it will use: git-hook |
| 141 | +| |
| 142 | +| The log file will be placed within the storage/log/ directory. |
| 143 | +| |
| 144 | +*/ |
| 145 | +'logfile' => 'git-hook', |
| 146 | + |
| 147 | + |
| 148 | +/* |
| 149 | +|-------------------------------------------------------------------------- |
| 150 | +| Url parameter |
| 151 | +|-------------------------------------------------------------------------- |
| 152 | +| |
| 153 | +| Please specify a url parameter. The router will adapt to it automatically. |
| 154 | +| |
| 155 | +| Example: if you enter 'another-git-hook' |
| 156 | +| It will be transformed into: https://your-domain.tld/another-git-hook |
| 157 | +| |
| 158 | +*/ |
| 159 | +'url' => 'git-hook' |
| 160 | +``` |
| 161 | + |
| 162 | +## Change log |
| 163 | + |
| 164 | +Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently. |
| 165 | + |
| 166 | +## Testing |
| 167 | + |
| 168 | +``` bash |
| 169 | +$ composer test |
| 170 | +``` |
| 171 | + |
| 172 | +## Security |
| 173 | + |
| 174 | +If you discover any security related issues, please email [email protected] instead of using the issue tracker. |
| 175 | + |
| 176 | +## Credits |
| 177 | + |
| 178 | +- [Webklex][link-author] |
| 179 | +- All Contributors |
| 180 | + |
| 181 | +## License |
| 182 | + |
| 183 | +The MIT License (MIT). Please see [License File](LICENSE.md) for more information. |
| 184 | + |
| 185 | +[ico-version]: https://img.shields.io/packagist/v/Webklex/laravel-git-hook.svg?style=flat-square |
| 186 | +[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square |
| 187 | +[ico-travis]: https://img.shields.io/travis/Webklex/laravel-git-hook/master.svg?style=flat-square |
| 188 | +[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/Webklex/laravel-git-hook.svg?style=flat-square |
| 189 | +[ico-code-quality]: https://img.shields.io/scrutinizer/g/Webklex/laravel-git-hook.svg?style=flat-square |
| 190 | +[ico-downloads]: https://img.shields.io/packagist/dt/Webklex/laravel-git-hook.svg?style=flat-square |
| 191 | + |
| 192 | +[link-packagist]: https://packagist.org/packages/Webklex/laravel-git-hook |
| 193 | +[link-travis]: https://travis-ci.org/Webklex/laravel-git-hook |
| 194 | +[link-scrutinizer]: https://scrutinizer-ci.com/g/Webklex/laravel-git-hook/code-structure |
| 195 | +[link-code-quality]: https://scrutinizer-ci.com/g/Webklex/laravel-git-hook |
| 196 | +[link-downloads]: https://packagist.org/packages/Webklex/laravel-git-hook |
| 197 | +[link-author]: https://github.com/webklex |
0 commit comments