1.0.1 • Published 7 years ago

ember-cli-deploy-git-ci v1.0.1

Weekly downloads
7,033
License
MIT
Repository
github
Last release
7 years ago

ember-cli-deploy-git-ci

This is an ember-cli-deploy plugin for managing deployments to a git branch in a CI environment like Travis.

It takes care of configuring a git user and a deploy key to use when pushing your branch, but expects the actual publish to be managed by a plugin like ember-cli-deploy-git

NEVER COMMIT YOUR DEPLOY KEY IN PLAINTEXT TO SOURCE CONTROL. If you do, you should immediately revoke the key and generate a new one.

Installation

ember install ember-cli-deploy ember-cli-deploy-build ember-cli-deploy-git ember-cli-deploy-git-ci

Configuration

In config/deploy.js, (which ember-cli-deploy will helpfully generate for you), you can pass the following options within a git-ci key:

  • enabled: whether this plugin should activate at all (defaults to true if the CI environment variable is set, false otherwise in order not to interfere with local deploys)
  • userName: a user name to be reflected in the deploy commit (defaults to the active user.name config for the local repo if present, or Tomster otherwise)
  • userEmail: a user email to be reflected in the deploy commit (defaults to the active user.email config for the local repo if present, or tomster@emberjs.com otherwise)
  • deployKey: the text of the SSH private key to use for deploying (defaults to the DEPLOY_KEY environment variable; overrides deployKeyPath if both are set)
  • deployKeyPath: the path on disk to your deploy key

An example:

ENV['git-ci'] = {
  userName: 'DeployBot',
  userEmail: 'deploys@example.com',
  deployKey: process.env.SECRET_KEY
};

Setting Up a Deploy Key

  • Use ssh-keygen to generate a new public/private key pair:
    ssh-keygen -t rsa -b 4096 -N '' -f deploy_key
  • This will produce two files in your current directory: deploy_key (the private key) and deploy_key.pub (the public key). Do not commit these files to your repository.
  • Configure the public key with your git hosting provider. For Github, you can find this under the settings for your repository, at https://github.com/<user>/<repo>/settings/keys
  • Configure the private key with your CI provider. For Travis, the simplest way to accomplish this is by using the Travis CLI to set the DEPLOY_KEY environment variable for your repo:
    travis env set -- DEPLOY_KEY "$(cat deploy_key)"