vijaycs85/github-publisher

Publish files to github.

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

This package is auto-updated.

Last update: 2024-03-26 09:03:35 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.