vijaycs85/github-publisher

This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

Publish files to github.

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

This package is auto-updated.

Last update: 2021-11-26 04:24:53 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.