-
Notifications
You must be signed in to change notification settings - Fork 0
/
circle.yml
41 lines (40 loc) · 1.13 KB
/
circle.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
version: 2
jobs:
build:
working_directory: ~/branch-manager
docker:
- image: circleci/node:8.1.2
steps:
- checkout
- restore_cache:
keys:
- branch-manager-{{ checksum "yarn.lock" }}
- run:
name: Install dependencies
command: yarn
- run:
name: Build
command: yarn dist
- run:
name: Lint
command: yarn lint
- save_cache:
key: branch-manager-{{ checksum "yarn.lock" }}
paths:
- ~/.yarn-cache
- deploy:
name: Publish to NPM if tagged
working_directory: ~/branch-manager/build
command: |
set -euo pipefail
TAG=${CIRCLE_TAG:-}
if [[ ${TAG} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
yarn version --new-version "$TAG" --no-git-tag-version
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
npm publish
else
echo "Not publishing: build was not triggered by a proper release tag"
fi
deployment:
npm:
tag: /^[0-9]+\.[0-9]+\.[0-9]+$/