deploy-to-github-pages

1.0.1 • Public • Published

🚀 deploy-to-github-pages

npm GitHub release CircleCI npm

A Node and CLI tool that makes deploying to GitHub pages by branch easy and automatic, best used as part of a CI process.

On master (or on your specified defaultBranch or -m) your directory will be deployed to your GitHub page root similarly to other libraries, such as the wonderful gh-pages. On other branches, it'll be deployed under /branch/${branchName}, allowing your peers to QA your built docs/demos easily for better feedback.

It also sends a status to a Pull request, if one exists:

Installation

npm install -D deploy-to-github-pages

Usage

CLI

deploy-to-github-pages [...options]

Node

const deploy = require('deploy-to-github-pages');

deploy(options).catch(err => {
  console.log(err);
});

Options

Option flag description default env variable required required in CI
directory -d directory you wish to deploy 'public' * *
token -t GitHub token GITHUB_TOKEN * *
owner -o GitHub repo owner/org *
repo -r GitHub repo name *
branch -b branch name 'master' *
buildUrl -u link displayed when deployment fails
defaultBranch -m Your GitHub default branch 'master'

Therefore, if ran from CircleCI or GitHub Actions workflows with a GITHUB_TOKEN environment variable present and the directory to be deployed is named public, no configuration options are needed, so just the following is enough:

deploy-to-github-pages

or

deploy().catch(err => {
  console.log(err);
});

Contributing

  1. Run tests with yarn test.
  2. Develop.
  3. Bump version number in package.json according to semver and add an item that a release will be based on to CHANGELOG.md.
  4. Submit your pull request from a feature branch and get code reviewed.
  5. If the pull request is approved and the CircleCI build passes, you will be able to squash and merge.
  6. Code will automatically be released to GitHub and published to npm according to the version specified in the changelog and package.json.

Other

For features and bugs, feel free to add issues or contribute.

Package Sidebar

Install

npm i deploy-to-github-pages

Weekly Downloads

286

Version

1.0.1

License

MIT

Unpacked Size

35.5 kB

Total Files

36

Last publish

Collaborators

  • oliverviljamaa