1 | [![NPM version][npm-image]][npm-url]
|
2 | [![Downloads][downloads-image]][downloads-url]
|
3 | [![Join the chat at https://gitter.im/eslint/eslint](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/eslint/eslint?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
4 |
|
5 | # ESLint Release Tool
|
6 |
|
7 | This release tool has been extracted from the [ESLint](https://github.com/eslint/eslint) project so that it can be shared among projects. While it's intended for use in ESLint organization projects, it is shared freely so others might use it as well.
|
8 |
|
9 | Please note that while this project is shared freely, it is not intended to be a general-purpose utility. The functionality is highly specific to how ESLint projects handle releases and the project will remain very focused on this use case.
|
10 |
|
11 | **Warning:** There are minimal tests for this project and the API is rapidly changing. Use at your own risk.
|
12 |
|
13 | ## Installation
|
14 |
|
15 | You can install the ESLint release tool using [npm](https://npmjs.com):
|
16 |
|
17 | ```
|
18 | $ npm install eslint-release --save-dev
|
19 | ```
|
20 |
|
21 | ## Local Usage
|
22 |
|
23 | The ESLint release tool is designed to be used on the command line and has two modes: regular release and prerelease.
|
24 |
|
25 | To run a regular release:
|
26 |
|
27 | ```
|
28 | $ eslint-release
|
29 | ```
|
30 |
|
31 | To run a prerelease, you need to include the prerelease identifier:
|
32 |
|
33 | ```
|
34 | $ eslint-prerelease alpha
|
35 | ```
|
36 |
|
37 | You can optionally include the release tool in another Node.js script:
|
38 |
|
39 | ```js
|
40 | var ReleaseOps = require("eslint-release");
|
41 | ```
|
42 |
|
43 | ## CI Usage
|
44 |
|
45 | When run in a CI environment like Jenkins, the ESLint release tool has different commands that allow for incorporation into more complex release scripts. To start, you'll need to define two environment variables:
|
46 |
|
47 | * `NPM_TOKEN` - a token to use for `npm publish`. The token must be from a user that has permission to publish the package.
|
48 | * `ESLINT_GITHUB_TOKEN` - a token for a GitHub user that has `repo` permission (used for posting release notes).
|
49 |
|
50 | To run a release in a CI environment:
|
51 |
|
52 | ```
|
53 | $ eslint-ci-release
|
54 | ```
|
55 |
|
56 | This will generate a new version, update the changelog, and publish to npm but will not push back to GitHub. It will also generate a `.releaseInfo.json` file.
|
57 |
|
58 | Your CI system must manually push the repository changes to GitHub (including the version tag). After that, you can publish release notes by running:
|
59 |
|
60 | ```
|
61 | $ eslint-gh-release
|
62 | ```
|
63 |
|
64 | This command looks for the `.releaseInfo.json` file and uses that information to determine where to post release notes and what to post.
|
65 |
|
66 | **Note:** In Jenkins, `eslint-gh-release` must be run as the last step in the build (typically in a post-build script that occurs after the GitHub repository has been updated).
|
67 |
|
68 | ## What It Does
|
69 |
|
70 | When you run the release tool for a regular release, the following steps take place:
|
71 |
|
72 | 1. Updates your npm packages to ensure you're running everything with the version that would be installed with a fresh install (only outside of CI release)
|
73 | 1. Runs `npm test` to validate the release
|
74 | 1. Gathers the commit message for each commit since the last release
|
75 | 1. Calculates the next release version based on the [commit message format](http://eslint.org/docs/developer-guide/contributing/pull-requests#step-2-make-your-changes) of the changes since the last release
|
76 | 1. Updates `CHANGELOG.md` and commits the changes
|
77 | 1. Runs `npm version` to update the version
|
78 | 1. Pushes the repository to origin/master with tags (only outside of CI release)
|
79 | 1. Converts all line endings to Unix style
|
80 | 1. Publishes the package to npm
|
81 | 1. Reverts any file changes
|
82 |
|
83 | When you do a prerelease, the same steps are taken except that package is published to npm under the `next` tag instead of `latest`.
|
84 |
|
85 | ## Team
|
86 |
|
87 | These folks keep the project moving and are resources for help:
|
88 |
|
89 | * Nicholas C. Zakas ([@nzakas](https://github.com/nzakas)) - project lead
|
90 |
|
91 | ## Contributing
|
92 |
|
93 | Issues and pull requests will be triaged and responded to as quickly as possible. We operate under the [ESLint Contributor Guidelines](http://eslint.org/docs/developer-guide/contributing), so please be sure to read them before contributing. If you're not sure where to dig in, check out the [issues](https://github.com/eslint/eslint-release/issues).
|
94 |
|
95 | ### License
|
96 |
|
97 | MIT License
|
98 |
|
99 | ### Where to ask for help?
|
100 |
|
101 | Join our [Chatroom](https://gitter.im/eslint/eslint)
|
102 |
|
103 | [npm-image]: https://img.shields.io/npm/v/eslint-release.svg?style=flat-square
|
104 | [npm-url]: https://www.npmjs.com/package/eslint-release
|
105 | [downloads-image]: https://img.shields.io/npm/dm/eslint-release.svg?style=flat-square
|
106 | [downloads-url]: https://www.npmjs.com/package/eslint-release
|