⭕️
CircleCI
On this page
Basic example
yaml
version: 2references:npm_auth: &npm_authrun:name: Authenticate with registrycommand: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrcjobs:build:docker:- image: circleci/node:13.1.0-stretchsteps:- checkout- *npm_auth- restore_cache: # special step to restore the dependency cache# Read about caching dependencies: https://circleci.com/docs/2.0/caching/key: dependency-cache-{{ checksum "yarn.lock" }}- run:name: installcommand: yarn install- save_cache: # special step to save the dependency cachekey: dependency-cache-{{ checksum "yarn.lock" }}paths:- ./node_modules- run:name: buildcommand: yarn build- run:name: testcommand: yarn testdeploy-chromatic:docker:- image: circleci/node:ltssteps:- checkout- *npm_auth- attach_workspace:at: .- run:name: 'Trigger Chromatic release'command: |if [ "${CIRCLE_BRANCH}" != "master" ];thenyarn chromatic:ci -a $CHROMATIC_PROJECT_TOKEN --exit-zero-on-changes --exit-once-uploadedelse# We know any changes that make it to master *must* have been acceptedyarn chromatic:ci -a $CHROMATIC_PROJECT_TOKEN --exit-once-uploaded --auto-accept-changesfiworkflows:version: 2build-test:jobs:- build
Using the CircleCI tool locally
sh
# run a particular job locallycircleci local execute --job build -e NPM_TOKEN=9e012519-aba7-4372-8381-abcdefghijkl# validate a config locallycircleci config validate