New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up circleci npm autopublishing #47

Merged
merged 2 commits into from Dec 12, 2017
Jump to file or symbol
Failed to load files and symbols.
+72 −10
Diff settings

Always

Just for now

Next

Set up circleci npm autopublishing

Change-Type: patch
  • Loading branch information...
pimterry committed Nov 21, 2017
commit 54cc5bd4ad3acd874a2c0977e862e2923f606f2a
Copy path View file

This file was deleted.

Oops, something went wrong.
Copy path View file
@@ -0,0 +1,72 @@
---
version: 2
buildSteps: &buildSteps
- checkout
- run:
name: install-npm
command: npm install
- run:
name: test
command: npm test
- persist_to_workspace:
# Persist all job output, so we can (potentially) use it for deploys
root: ../
paths:
- ./node-*
jobs:
"node-6":
docker:
- image: circleci/node:6
working_directory: ~/node-6
steps: *buildSteps
"node-8":
docker:
- image: circleci/node:8
working_directory: ~/node-8
steps: *buildSteps
deploy:
# For this to work NPM_TOKEN must be set for the account used for publishing
docker:
- image: circleci/node:6
steps:
- attach_workspace:
at: $CIRCLE_WORKING_DIRECTORY
- run:
name: Login to npm
command: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm whoami
- deploy:
name: Deploy to npm
command: npm publish
# Output used for publish is from node 6 build
working_directory: $CIRCLE_WORKING_DIRECTORY/node-6
workflows:
version: 2
build:
jobs:
- "node-6":
# Run for all tags (required to allow the deploy to trigger on version tags)
filters:
tags:
only: /.*/
- "node-8":
# Run for all tags (required to allow the deploy to trigger on version tags)
filters:
tags:
only: /.*/
- deploy:
# Deploy passing builds if they're tagged with a version
requires:
- "node-6"
- "node-8"
filters:
tags:
only: /^v\d+\.\d+\.\d+$/
branches:
ignore: /.*/
ProTip! Use n and p to navigate between commits in a pull request.