1 | # Using semantic-release with [CircleCI 2.0 workflows](https://circleci.com/docs/2.0/workflows)
|
2 |
|
3 | ## Environment variables
|
4 |
|
5 | The [Authentication](../usage/ci-configuration.md#authentication) environment variables can be configured in [CircleCi Project Settings](https://circleci.com/docs/2.0/env-vars/#adding-environment-variables-in-the-app)..
|
6 |
|
7 | Alternatively, the default `NPM_TOKEN` and `GH_TOKEN` can be easily [setup with semantic-release-cli](../usage/getting-started.md#getting-started).
|
8 |
|
9 | ## Multiple Node jobs configuration
|
10 |
|
11 | ### `.circleci/config.yml` configuration for multiple Node jobs
|
12 |
|
13 | This example is a minimal configuration for **semantic-release** with a build running Node 6 and 8. See [CircleCI documentation](https://circleci.com/docs/2.0) for additional configuration options.
|
14 |
|
15 | This example create the workflows `test_node_4`, `test_node_6`, `test_node_8` and `release`. The release workflows will [run `semantic-release` only after the all the `test_node_*` are successful](../usage/ci-configuration.md#run-semantic-release-only-after-all-tests-succeeded).
|
16 |
|
17 | ```yaml
|
18 | version: 2
|
19 | jobs:
|
20 | test_node_6:
|
21 | docker:
|
22 | - image: circleci/node:6
|
23 | steps:
|
24 | # Configure your test steps here (checkout, npm install, cache management, tests etc...)
|
25 |
|
26 | test_node_8:
|
27 | docker:
|
28 | - image: circleci/node:8
|
29 | steps:
|
30 | # Configure your test steps here (checkout, npm install, cache management, tests etc...)
|
31 |
|
32 | release:
|
33 | docker:
|
34 | - image: circleci/node:8
|
35 | steps:
|
36 | - checkout
|
37 | - run: npm install
|
38 | # Run optional required steps before releasing
|
39 | # - run: npm run build-script
|
40 | - run: npx semantic-release
|
41 |
|
42 | workflows:
|
43 | version: 2
|
44 | test_and_release:
|
45 | # Run the test jobs first, then the release only when all the test jobs are successful
|
46 | jobs:
|
47 | - test_node_6
|
48 | - test_node_8
|
49 | - release:
|
50 | requires:
|
51 | - test_node_6
|
52 | - test_node_8
|
53 | ```
|
54 |
|
55 | ### `package.json` configuration for multiple Node jobs
|
56 |
|
57 | A `package.json` is required only for [local](../usage/installation.md#local-installation) **semantic-release** installation.
|
58 |
|
59 | ```json
|
60 | {
|
61 | "devDependencies": {
|
62 | "semantic-release": "^15.0.0"
|
63 | }
|
64 | }
|
65 | ```
|