Skip to content

julkue/git-branch-deploy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Git Branch Deploy

A Node.js tool to deploy build artifacts to a GitHub branch using a Git commit.

Installation

$ npm i @julmot/git-branch-deploy

Deployment

const deploy = require('@julmot/git-branch-deploy');

deploy({
  branch: 'website', // Name of the target branch
  sourceDir: `${__dirname}/library/`, // Folder where the build artifacts are located
  deployDir: `${__dirname}/deploy/`, // Build folder where the GitHub repository can be cloned to
  gitName: process.env.GIT_USER_NAME, // The name that should appear in the Git commit
  gitEmail: process.env.GIT_USER_EMAIL, // The e-mail address to use in the Git commit
  ghRepository: process.env.GITHUB_REPOSITORY, // The GitHub repository URL, e.g. https://github.com/julmot/git-branch-deploy
  ghUser: process.env.GITHUB_USERNAME, // The GitHub username of the account with which the commit should be pushed
  ghToken: process.env.GITHUB_TOKEN, // A GitHub private access key of the account with which the commit should be pushed
  travis: true // Makes sure the deployment only succeeds when running on Travis CI
});

The above mentioned values are the default values, except:

  • branch
  • sourceDir
  • deployDir

which must be provided (no default values). So, the minimal example would be:

deploy({
  branch: 'website',
  sourceDir: `${__dirname}/library/`,
  deployDir: `${__dirname}/deploy/`
});

NOTE: Make sure that the target branch in the repository exists on GitHub. To create an empty branch you can use these instructions.

About

A Node.js tool to deploy build artifacts to a GitHub branch using a Git commit.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published