|
| 1 | +# @eclass/semantic-release-netlify |
| 2 | + |
| 3 | +[](https://www.npmjs.com/package/@eclass/semantic-release-netlify) |
| 4 | +[](https://travis-ci.org/eclass/semantic-release-netlify) |
| 5 | +[](https://www.npmjs.com/package/@eclass/semantic-release-netlify) |
| 6 | +[](https://david-dm.org/eclass/semantic-release-netlify) |
| 7 | +[](https://david-dm.org/eclass/semantic-release-netlify#info=devDependencies) |
| 8 | +[](https://coveralls.io/github/eclass/semantic-release-netlify?branch=master) |
| 9 | +[](https://codeclimate.com/github/eclass/semantic-release-netlify/maintainability) |
| 10 | +[](https://github.com/semantic-release/semantic-release) |
| 11 | + |
| 12 | +> [semantic-release](https://github.com/semantic-release/semantic-release) plugin to deploy app with [netlify](https://netlify.com) |
| 13 | +
|
| 14 | +| Step | Description | |
| 15 | +|--------------------|---------------------------------------------------------------------------------------------| |
| 16 | +| `verifyConditions` | Verify the presence of the `NETLIFY_AUTH_TOKEN` and `NETLIFY_SITE_ID` environment variable. | |
| 17 | +| `publish` | Upload assets to netlify. | |
| 18 | + |
| 19 | +## Install |
| 20 | + |
| 21 | +```bash |
| 22 | +npm i -D @eclass/semantic-release-netlify |
| 23 | +``` |
| 24 | + |
| 25 | +## Usage |
| 26 | + |
| 27 | +The plugin can be configured in the [**semantic-release** configuration file](https://github.com/semantic-release/semantic-release/blob/caribou/docs/usage/configuration.md#configuration): |
| 28 | + |
| 29 | +```json |
| 30 | +{ |
| 31 | + "plugins": [ |
| 32 | + "@semantic-release/changelog", |
| 33 | + "@semantic-release/npm", |
| 34 | + "@semantic-release/git", |
| 35 | + "@semantic-release/gitlab", |
| 36 | + "@eclass/semantic-release-netlify" |
| 37 | + ] |
| 38 | +} |
| 39 | +``` |
| 40 | + |
| 41 | +## Configuration |
| 42 | + |
| 43 | +### Netlify authentication |
| 44 | + |
| 45 | +The netlify authentication configuration is **required** and can be set via [environment variables](#environment-variables). |
| 46 | + |
| 47 | +### Environment variables |
| 48 | + |
| 49 | +| Variable | Description | |
| 50 | +| -------------------- | ----------------------------------------------------------------- | |
| 51 | +| `NETLIFY_AUTH_TOKEN` | Netlify token created via [personal access tokens](https://app.netlify.com/account/applications/personal) | |
| 52 | +| `NETLIFY_SITE_ID` | Netlify site ID created via [netlify sites:create](https://www.netlify.com/docs/cli/#getting-help) | |
| 53 | + |
| 54 | +### Examples |
| 55 | + |
| 56 | +```json |
| 57 | +{ |
| 58 | + "plugins": [ |
| 59 | + "@semantic-release/changelog", |
| 60 | + "@semantic-release/npm", |
| 61 | + "@semantic-release/git", |
| 62 | + "@semantic-release/gitlab", |
| 63 | + "@eclass/semantic-release-netlify" |
| 64 | + ] |
| 65 | +} |
| 66 | +``` |
| 67 | + |
| 68 | +```yml |
| 69 | +# .gitlab-ci.yml |
| 70 | +release: |
| 71 | + image: node:11-alpine |
| 72 | + stage: release |
| 73 | + before_script: |
| 74 | + - npm i -g netlify-cli |
| 75 | + script: |
| 76 | + - npx semantic-release |
| 77 | + only: |
| 78 | + - master |
| 79 | +``` |
| 80 | +
|
| 81 | +```yml |
| 82 | +# .travis.yml |
| 83 | +language: node_js |
| 84 | +cache: |
| 85 | + directories: |
| 86 | + - ~/.npm |
| 87 | +node_js: |
| 88 | + - "11" |
| 89 | +stages: |
| 90 | + - test |
| 91 | + - name: deploy |
| 92 | + if: branch = master |
| 93 | +jobs: |
| 94 | + include: |
| 95 | + - stage: test |
| 96 | + script: npm t |
| 97 | + - stage: deploy |
| 98 | + before_script: |
| 99 | + - npm i -g netlify-cli |
| 100 | + script: npx semantic-release |
| 101 | + |
| 102 | +``` |
| 103 | + |
| 104 | +## License |
| 105 | + |
| 106 | +[MIT](https://tldrlegal.com/license/mit-license) |
0 commit comments