Publish files to github.

1.0.0-alpha2 2019-02-25 21:53 UTC

This package is auto-updated.

Last update: 2023-01-26 06:41:25 UTC


Runs CLI commands to clone a github repository and commits the changes and push to given branch.

WARNING: Executes commands using exec().


composer require vijaycs85/github-publisher



require_once __DIR__ . '/vendor/autoload.php';

use Vijaycs85\GithubPublisher\Repository;
use Vijaycs85\GithubPublisher\Builder;

// Github repository name in username/projectname format.
$repository = new Repository('vijaycs85/static-site', \getenv('GITHUB_TOKEN'));

// Pass location of clone.
$builder = new Builder(__DIR__ . '/build', $repository);

// Directory that contains souce code and branch to push.
$builder->publish(__DIR__ . '/public', 'gh-pages');

NOTE: Get the token from Personal access tokens.