vijaycs85 / github-publisher
Publish files to github.
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 0
Type:project
Requires
- php: ^7.1
This package is auto-updated.
Last update: 2024-10-26 10:15:09 UTC
README
Runs CLI commands to clone a github repository and commits the changes and push to given branch.
WARNING: Executes commands using exec()
.
Install
composer require vijaycs85/github-publisher
Usage
<?php
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.