konstantinn / laravel-github-deploy
Easy deploy laravel project to github.
Package info
github.com/k0nstantin777/laravel-github-deploy
pkg:composer/konstantinn/laravel-github-deploy
Requires
- php: ^7.2
- illuminate/routing: ~5.8.0|^6.0
- illuminate/support: ~5.8.0|^6.0
- symfony/process: ^4.4
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
About
This package allows you to automate the publication of updates to your server, after publishing them to Github.
Install
composer require konstantinn/laravel-github-deploy
Go to your remote server and set url git origin repository with user and pass:
git remote set-url origin https://USERNAME:PASSWORD@github.com/USERNAME/REPOSITORY.git
Publish config file deploy.php
php artisan vendor:publish --provider="Konstantinn\LaravelGitHubDeploy\DeployServiceProvider"
By default, the log is written to the file storage/logs/deploy.log, but you can change the path in the config file deploy.php
Open VerifyCsrfToken middleware and add route '/deploy' to except protected property:
class VerifyCsrfToken extends Middleware { /** * Indicates whether the XSRF-TOKEN cookie should be set on the response. * * @var bool */ protected $addHttpCookie = true; /** * The URIs that should be excluded from CSRF verification. * * @var array */ protected $except = [ '/deploy' ]; }
Go to your GitHub repository and create webhook with Payload Url: https://SITE.DOMEN/deploy
Fill Secret field and copy this data and paste in .env file:
APP_DEPLOY_SECRET=GIH_HUB_HOOK_SECRET
Check request webhook in Recent Deliver part.
Whats all!
Deploy Сommands
By default deploy runs next commands:
'commands' => [ 'git pull', 'composer install --no-interaction --no-dev --prefer-dist', 'php artisan migrate --force', ],
But you can add or modify commands in config file deploy.php.
Contributors
- @k0nstantin777 the original author of this package.