@@ -31,134 +31,74 @@ You can publish everything at once
31
31
php artisan vendor:publish --provider="Webklex\GitHook\Providers\LaravelServiceProvider"
32
32
```
33
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
34
## Usage
41
35
42
36
This library is designed to handle the automatic deployment by git hooks
43
37
as simple as possible. There isn't much todo to get started: just add the
44
38
Provider and edit the ` config/git-hook.php ` file to make it fit your needs.
45
39
46
40
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
-
41
+ Custom configuration can be made within the ` config/git-hook.php ` file:
42
+
43
+ Get notified by mail. Just add your credentials:
44
+ ```
45
+ 'email_recipients' => [
46
+ [
47
+ ['name' => 'Admin', 'address' => '[email protected] '],
48
+ ...
49
+ ]
50
+ ],
51
+ ```
65
52
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
- */
53
+ Specify a custom email sender address:
54
+ ```
75
55
'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
- */
56
+ ```
57
+
58
+ Perhaps your repository is somehow specially structured, if that's the case, specify yozr
59
+ repository path below:
60
+ ```
90
61
'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
- */
62
+ ```
63
+
64
+ If you want to secure the deployment process a bit more, whitelist the repository IPs:
65
+ ```
105
66
'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
- */
67
+ ```
68
+
69
+ Your remote branch
70
+ ```
116
71
'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
- */
72
+ ```
73
+
74
+ Where is the git binary located? By default /usr/bin/git will be used.
75
+ ```
129
76
'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
- */
77
+ ```
78
+
79
+ How sould the logfile be named?
80
+ ```
145
81
'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
- */
82
+ ```
83
+
84
+ Define your remote git service. This is required to identify the payload.
85
+ Currently supported: ` github ` , ` gitbucket `
86
+ ```
87
+ 'service' => 'github',
88
+ ```
89
+
90
+ How should your deployment url (git hook) look like? You can be as creative as you want ;)
91
+ If you are concerned someone could guess it, use a more cryptic url such as: ` JHFUjhd67567JHFGhsd78236784wegfJHFghdgf `
92
+ ```
159
93
'url' => 'git-hook'
160
94
```
161
95
96
+ ## Potential problems:
97
+
98
+ Please make sure your ` www-data ` user can actually perform a git pull on the server without
99
+ having to enter a password:
100
+ so you might want to take a look at ssh-keys or something similar
101
+
162
102
## Change log
163
103
164
104
Please see [ CHANGELOG] ( CHANGELOG.md ) for more information what has changed recently.
0 commit comments