library github-deployment
Deployment with GitHub and pure PHP. No git on server or ftp needed.
godric/github-deployment
Deployment with GitHub and pure PHP. No git on server or ftp needed.
- Monday, December 11, 2017
- by godric
- Repository
- 1 Watchers
- 0 Stars
- 9 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 1 Versions
- 0 % Grown
Deploy with GitHub and pure PHP. No git on server or ftp needed., (*1)
Usage
- Install with:
composer require godric/github-deployment dev-master
- Create deployment script, for example
deploy.php with following contents:
<?php // deploy.php in website root
require 'vendor/autoload.php';
(new Godric\GithubDeployment\GithubDeployment([
'secret' => 'your_secret', // pick your secret
'target' => __DIR__ . '/.', // directory beeing synchronized – same as deploy.php
]))->autorun();
- Upload new files to your server.
- Go to: (your github repo) > settings > webhooks > add webhook
- Set url to
http://yoursite.com/deploy.php and secret to your_secret.
- Done! From now on, all files added/modified/removed in new commits to
master will appear on your server.
Features
- No need for git or
system() calls on remote server – should work well with shared hosts.
- Works with pushes to master as well as pull-request merging.
- Multiple commits in one push are also OK.
- Current contents of remote directory are not modified – only changes in commits are applied.
- Automatic
composer install on remote before updating files.
- TODO: custom before or after scripts (for example DB migrations).
Requirements
- Write access to target directory.
Notes
Test scenarios TBD
- new file in non-existent directory
- exotic directory names
dev-master
9999999-dev
Deployment with GitHub and pure PHP. No git on server or ftp needed.
Sources
Download
The Requires