|
1 | | -# git-deploy-laravel |
| 1 | +# Deployments Laravel projects using Git webhooks |
2 | 2 |
|
3 | | -Helps automate the deployment of Laravel projects onto servers by utilising webhooks. |
| 3 | +git-deploy-laravel assists deployment by receiving a push event message from your repository's server and automatically pulling project code. |
4 | 4 |
|
5 | | -This should work out-of-the-box with webhooks from GitHub and GitLab servers. |
6 | | - |
7 | | -**Only tested with Laravel 5.1.1 and GitLab 7.14** |
| 5 | +This should work out-of-the-box with Laravel 5.x using with webhooks from GitHub and GitLab servers. |
8 | 6 |
|
9 | 7 | This is an internal tool to help with our common workflow pattern but please feel free to borrow, change and improve. |
10 | 8 |
|
11 | 9 | ## Installation |
12 | 10 |
|
13 | | -Add the following to your `composer.json` file: |
| 11 | + |
| 12 | +### Step 1 |
| 13 | + |
| 14 | +Add the following to your `composer.json` file then update your composer as normal: |
14 | 15 |
|
15 | 16 | { |
16 | 17 | "require" : { |
17 | 18 | "orphans/git-deploy-laravel" : "dev-master" |
18 | 19 | } |
19 | 20 | } |
20 | 21 |
|
21 | | -Then install/update your composer project as normal. |
| 22 | +Or run: |
| 23 | + |
| 24 | + composer require orphans/git-deploy-laravel |
| 25 | + |
| 26 | +### Step 2 |
22 | 27 |
|
23 | 28 | Add the following line to you providers in `config/app.php`: |
24 | 29 |
|
25 | 30 | Orphans\GitDeploy\GitDeployServiceProvider::class, |
26 | 31 |
|
27 | | -And the `git-deploy` route to the `$except` variable in your route CRSF middleware file in `app/Http/Middleware/VerifyCsrfToken.php`: |
| 32 | +### Step 3 |
| 33 | + |
| 34 | +Add the _/git-deploy_ route to CSRF exceptions so your repo's host can send messages to your project. |
| 35 | + |
| 36 | + |
| 37 | +In file in `app/Http/Middleware/VerifyCsrfToken.php` add: |
28 | 38 |
|
29 | 39 | protected $except = [ |
30 | 40 | 'git-deploy', |
31 | 41 | ]; |
32 | 42 |
|
33 | 43 | ## Usage |
34 | 44 |
|
35 | | -Add a webhook for http://your.website.url/git-deploy to your project in GitHub/GitLab and this package will take care of the rest. |
| 45 | +Add a webhook for http://your.website.url/git-deploy to your project in GitHub/GitLab and this package will take care of the rest. The webhook should fire on push-events. |
36 | 46 |
|
37 | | -It will automatically receive POST messages from the repo manager and perform a Git pull. |
| 47 | +Your website will automatically receive POST messages from the repo manager and perform a Git pull. |
38 | 48 |
|
39 | 49 | ## Configuration |
40 | 50 |
|
41 | | -There is (potentially) important configuration in the package's config file, for things like the email notifications and your repository's root path on the file system. |
42 | | - |
43 | | -> Note that this tool tries to automatically determine the repository's root path and that should work suffiently in most cases. |
| 51 | +In most cases the package will find the correct Git repository and Git executable but we advise publishing our config anyway because it will let you enable extra security options and email notifications. |
44 | 52 |
|
45 | 53 | To add custom configuration run: |
46 | 54 |
|
47 | | - php artisan vendor:publish |
| 55 | + php artisan vendor:publish --provider="Orphans\GitDeploy\GitDeployServiceProvider" |
48 | 56 |
|
49 | | -Then edit `/config/gitdeploy.php` which has been well commented. |
| 57 | +Then edit `/config/gitdeploy.php`, which has been well commented. |
50 | 58 |
|
51 | 59 | ## Future Plans |
52 | 60 |
|
53 | | -* Testing on GitHub and different versions of Laravel & GitLab. |
54 | 61 | * Branch management (i.e. only tigger on changes to active branch). |
55 | 62 | * Email report on code conflicts that prevent a pull. |
0 commit comments