Skip to content

Commit 43e9f64

Browse files
authored
Merge pull request #2 from platformsh/circleci-npm
Add deploy hook for circleci to npm
2 parents 86cf8b6 + e24bbcc commit 43e9f64

2 files changed

Lines changed: 47 additions & 20 deletions

File tree

.circleci/config.yml

Lines changed: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,62 @@
33
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
44
#
55
version: 2
6+
workflows:
7+
version: 2
8+
build_and_deploy:
9+
jobs:
10+
- build:
11+
filters:
12+
tags:
13+
only: /.*/
14+
- deploy:
15+
requires:
16+
- build
17+
filters:
18+
tags:
19+
only: /[0-9]+(\.[0-9]+)*/
20+
branches:
21+
only:
22+
- master
23+
624
jobs:
725
build:
26+
working_directory: ~/repo
827
docker:
9-
# specify the version you desire here
1028
- image: circleci/node:10.0
1129

12-
# Specify service dependencies here if necessary
13-
# CircleCI maintains a library of pre-built images
14-
# documented at https://circleci.com/docs/2.0/circleci-images/
15-
# - image: circleci/mongo:3.4.4
16-
17-
working_directory: ~/repo
18-
1930
steps:
2031
- checkout
21-
22-
# Download and cache dependencies
23-
- restore_cache:
32+
- restore_cache: # ensure this step occurs *before* installing dependencies
2433
keys:
25-
- v1-dependencies-{{ checksum "package.json" }}
26-
# fallback to using the latest cache if no exact match is found
27-
- v1-dependencies-
28-
34+
- v{{ .Environment.CACHE_VERSION }}-dep-cache-{{ .Branch }}-{{ checksum "package.json" }}
35+
- v{{ .Environment.CACHE_VERSION }}-dep-cache-{{ .Branch }}-
36+
- v{{ .Environment.CACHE_VERSION }}-dep-cache-
2937
- run: npm install
30-
3138
- save_cache:
3239
paths:
3340
- node_modules
34-
key: v1-dependencies-{{ checksum "package.json" }}
35-
36-
# run tests!
41+
key: v{{ .Environment.CACHE_VERSION }}-dep-cache-{{ .Branch }}-{{ checksum "package.json" }}
3742
- run: npm test
43+
deploy:
44+
working_directory: ~/repo
45+
docker:
46+
- image: circleci/node:10.0
47+
steps:
48+
- checkout
49+
- restore_cache: # ensure this step occurs *before* installing dependencies
50+
keys:
51+
- v{{ .Environment.CACHE_VERSION }}-dep-cache-{{ .Branch }}-{{ checksum "package.json" }}
52+
- v{{ .Environment.CACHE_VERSION }}-dep-cache-{{ .Branch }}-
53+
- v{{ .Environment.CACHE_VERSION }}-dep-cache-
54+
- run: npm install
55+
- save_cache:
56+
paths:
57+
- node_modules
58+
key: v{{ .Environment.CACHE_VERSION }}-dep-cache-{{ .Branch }}-{{ checksum "package.json" }}
59+
- run:
60+
name: Authenticate with registry
61+
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/repo/.npmrc
62+
- run:
63+
name: Publish package
64+
command: npm publish

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "platformsh-config",
3-
"version": "2.0.1",
3+
"version": "2.0.3",
44
"description": "Helper for running nodejs applications on Platform.sh",
55
"main": "lib/platformsh.js",
66
"keywords": [

0 commit comments

Comments
 (0)