UNPKG

5.54 kBMarkdownView Raw
1# semantic-release-cli
2
3[![Travis](https://img.shields.io/travis/semantic-release/cli.svg)](https://travis-ci.org/semantic-release/cli)
4[![Greenkeeper badge](https://badges.greenkeeper.io/semantic-release/cli.svg)](https://greenkeeper.io/)
5
6## Install
7
8```bash
9npm install -g semantic-release-cli
10
11cd your-module
12semantic-release-cli setup
13```
14
15![dialogue](https://cloud.githubusercontent.com/assets/908178/8766357/f3eadaca-2e34-11e5-8ebb-d40b9ae613d7.png)
16
17## Options
18
19 Usage:
20 semantic-release-cli setup [options]
21
22 Options:
23 -h --help Show this screen.
24 -v --version Show version.
25 --[no-]keychain Use keychain to get passwords [default: true].
26 --ask-for-passwords Ask for the passwords even if passwords are stored [default: false].
27 --tag=<String> npm tag to install [default: 'latest'].
28 --gh-token=<String> GitHub auth token
29 --npm-token=<String> npm auth token
30 --gh-username=<String> GitHub username
31 --npm-username=<String> npm username
32
33 Aliases:
34 init setup
35
36## What it Does
37__semantic-release-cli performs the following steps:__
38
391. Asks for the information it needs. You will need to provide it with:
40 * Whether your GitHub repository is public or private
41 * Which npm registry you want to use (Default: https://registry.npmjs.org/)
42 * Your npm username (unless passwords were previously saved to keychain)
43 * Your npm email
44 * Your npm password
45 * Your GitHub username
46 * Your GitHub password (unless passwords were previously saved to keychain)
47 * Which continuous integration system you want to use. (Options: Travis CI / Pro / Enterprise / CircleCI, or Other)
48 * [Travis only] Whether you want to test a single node.js version (e.g. - 8) or multiple node.js versions (e.g. - 4, 6, 8, etc.)
491. npm Add User
50 * Runs `npm adduser` with the npm information provided to generate a `.npmrc`
51 * Parses the npm token from the `.npmrc` for future use
521. Create GitHub Personal Token
53 * Logs into GitHub using the username and password provided
54 * Creates (and saves for later use) a [GitHub Personal Access Token](https://github.com/settings/tokens) with the following permissions: *repo, read:org, repo:status, repo_deployment, user:email, write:repo_hook*
551. Update your `package.json`
56 * Set `version` field to `0.0.0-development` (`semantic-release` will set the version for you automatically)
57 * Add a `semantic-release` script: `"semantic-release": "semantic-release"`
58 * Add `semantic-release` as a `devDependency`
59 * Add or overwrite the [`repository` field](https://docs.npmjs.com/files/package.json#repository)
60
61## Travis CI
62For Travis CI, `semantic-release-cli` performs the following additional steps:
631. Overwrite your `.travis.yml` file
64 * `after_success`: `npm install -g travis-deploy-once` and `travis-deploy-once "npm run semantic-release"`: run `semantic-release` exactly once after all builds pass
65 * Set other sane defaults: `cache: directories: ~/.npm`, `notifications: email: false`
661. Login to Travis CI to configure the package. This step requires your module to define a valid, case-sensitive
67[`repository` field](https://docs.npmjs.com/files/package.json#repository).
68 * Enable builds of your repo
69 * Add `GH_TOKEN` and `NPM_TOKEN` environment variables in the settings
70
71## CircleCI
72
73For CircleCI, `semantic-release-cli` performs the following additional steps:
741. Create minimal `config.yml` file (if CircleCI was selected)
75```yml
76version: 2
77jobs:
78 build:
79 docker:
80 - image: 'circleci/node:latest'
81 steps:
82 - checkout
83 - run:
84 name: install
85 command: npm install
86 - run:
87 name: release
88 command: npm run semantic-release || true
89```
902. Login to CircleCI to configure the package
91 * Enable builds of your repo
92 * Add `GH_TOKEN` and `NPM_TOKEN` environment variables in the settings
93
94## Other CI Servers
95
96By default, `semantic-release-cli` supports the popular Travis CI and CircleCI servers. If you select `Other` as your server during configuration, `semantic-release-cli` will print out the environment variables you need to set on your CI server. You will be responsible for adding these environment variables as well as configuring your CI server to run `npm run semantic-release` after all the builds pass.
97
98Note that your CI server will also need to set the environment variable `CI=true` so that `semantic-release` will not perform a dry run. (Most CI services do this by default.) See the `semantic-release` documentation for more details.
99
100## Setting defaults
101
102This package reads your npm username from your global `.npmrc`. In order to autosuggest a username in the future, make sure to set your username there: `npm config set username <username>`.
103
104It also reads your GitHub username from your global `.gitconfig`. In order to autosuggest a username in the future, run `git config --global --add github.username <username>`. If a name isn't defined here, it will default to using your npm username, as it will assume they are identical.
105
106## Contribute
107
108Please contribute! We welcome issues and pull requests.
109
110When committing, please conform to [the semantic-release commit standards](https://github.com/semantic-release/semantic-release#default-commit-message-format).
111
112## License
113
114MIT License
1152015 © Christoph Witzko and [contributors](https://github.com/semantic-release/cli/graphs/contributors)
116
117![https://twitter.com/trodrigues/status/509301317467373571](https://cloud.githubusercontent.com/assets/908178/6091690/cc86f58c-aeb8-11e4-94cb-15f15f486cde.png)