ember-cli-deploy-git-ci
v1.0.1
Published
An ember-cli-deploy plugin for managing git deploys in CI.
Downloads
18,426
Maintainers
Readme
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 theCI
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 activeuser.name
config for the local repo if present, orTomster
otherwise)userEmail
: a user email to be reflected in the deploy commit (defaults to the activeuser.email
config for the local repo if present, or[email protected]
otherwise)deployKey
: the text of the SSH private key to use for deploying (defaults to theDEPLOY_KEY
environment variable; overridesdeployKeyPath
if both are set)deployKeyPath
: the path on disk to your deploy key
An example:
ENV['git-ci'] = {
userName: 'DeployBot',
userEmail: '[email protected]',
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) anddeploy_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)"