Skip to content
This repository has been archived by the owner on Apr 4, 2022. It is now read-only.

Commit

Permalink
Update CircleCI configs to support auto publishing based on tags
Browse files Browse the repository at this point in the history
  • Loading branch information
limtingzhi committed Oct 30, 2019
1 parent 6c4567c commit 027be76
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 25 deletions.
98 changes: 73 additions & 25 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,81 @@
version: 2
version: 2.1

commands:
install:
description: 'Yarn install'
steps:
- restore_cache: # Special step to restore the dependency cache
key: dependency-cache-{{ checksum "package.json" }}
- run: yarn install
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- node_modules
- yarn.lock

jobs:
build:
lint:
working_directory: ~/repo
docker:
- image: circleci/node:12.10
steps:
- checkout
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }}
- yarn-packages-{{ .Branch }}
- yarn-packages-master
- yarn-packages-
- run:
name: Install Dependencies
command: yarn install
- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }}
paths:
- node_modules/
# Tests
- install
- run: yarn lint
test:
working_directory: ~/repo
docker:
- image: circleci/node:12.10
steps:
- checkout
- install
- run: yarn test
build:
working_directory: ~/repo
docker:
- image: circleci/node:12.10
steps:
- checkout
- install
- run: yarn build
# Teardown
- store_test_results:
path: /tmp/circleci-test-results
- store_artifacts:
path: /tmp/circleci-artifacts
- store_artifacts:
path: /tmp/circleci-test-results
publish:
working_directory: ~/repo
docker:
- image: circleci/node:12.10
steps:
- checkout
- attach_workspace:
# Must be absolute path or relative path from working_directory
at: ~/repo
- install
- run:
name: Authenticate with registry
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/repo/.npmrc
- run: npm publish

workflows:
version: 2
deploy:
jobs:
- lint:
filters:
tags:
only: /.*/
- test:
filters:
tags:
only: /.*/
- build:
filters:
tags:
only: /.*/
- publish:
requires:
- lint
- test
- build
filters:
branches:
ignore: /.*/
tags:
only: /v[0-9]+\.[0-9]+\.[0-9]+.*/
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Dependencies to their latest versions
- CircleCI node version to 12.10
- CircleCI configs to support auto publishing based on tags

## Change

Expand Down

0 comments on commit 027be76

Please sign in to comment.