UNPKG

1.7 kBMarkdownView Raw
1
2# prebuild-ci
3
4Use CI like [travis](https://travis-ci.org/) and [appveyor](https://www.appveyor.com/) to auto upload [prebuilds](https://github.com/mafintosh/prebuild).
5
6Requires you to use prebuild@6 or later.
7
8## Motivation
9
10It's great to provide prebuilds with your native node modules, so consumers don't have to compile them on install - a pre made binary will simply be fetched.
11It can however be cumbersome to create those binaries yourself, you need to run the appropriate scripts on every OS you desire to ship.
12This module provides an alternative by creating and uploading those binaries in the CI environments you use, so for example using travis and appveyor you can
13cover all node versions on mac OS, linux and windows, automatically!
14
15## Usage
16
17Add `prebuild-ci` to your `"test"` script or CI configuration, like this:
18
19```json
20 "scripts": {
21 "test": "mocha && prebuild-ci"
22 }
23```
24
25Also configure your CI environments to set the environment variable `PREBUILD_TOKEN` to your [prebuild upload token](https://github.com/mafintosh/prebuild#create-github-token), and make sure this variable is only set on pull requests from the same repository.
26
27Then, whenever a CI job passes _and_ updates `"version"` in the module's `package.json`, the prebuild for the current environment will be uploaded to GitHub.
28
29That means that in order to have prebuilds for all desired os / node combinations, make sure to run each of those in a CI job.
30
31__Pro Tipp:__ In order for prebuilds to be available as soon as a new version is published to npm, wait with the actual `npm publish` until all the CI jobs have completed.
32
33## Installation
34
35```bash
36$ npm install --save prebuild-ci
37```
38
39## License
40
41MIT