sh CircleCI部署到NPM

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh CircleCI部署到NPM相关的知识,希望对你有一定的参考价值。

machine:
  node:
    version: 6.9.5

dependencies:
  pre:
    - 'echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc'
test:
  override:
    - rm -rf $CIRCLE_ARTIFACTS/coverage
    - npm run lint
    - npm run test
    - cp -r coverage $CIRCLE_ARTIFACTS
    - node node_modules/coveralls/bin/coveralls.js < coverage/coverage.lcov

compile:
  override:
    - npm run build

deployment:
  feature:
    branch: master
    commands:
      - ./config/npm-deploy-feature.sh
  production:
    tag: /(v)?[0-9]+(\.[0-9]+)*/
    commands:
      - ./config/npm-deploy.sh
#!/bin/bash
git config --global -l
git config --global user.email circleci@circleci
git config --global user.name CircleCI
git remote --v

# Get the last tag from GitHub
lastTag=$(git describe --tags $(git rev-list --tags --max-count=1))

# Bump the version
npm version $lastTag-feature.$CIRCLE_BUILD_NUM

# Push the new tag to Github
git push --tags

# Copy files to dist
cpx package.json dist
cpx README.md dist

# Publish to NPM
npm publish --tag feature
#!/bin/bash

# Get the last tag from GitHub
lastTag=$(git describe --tags $(git rev-list --tags --max-count=1))

# Print it to the console for verification
echo "Bumping version to new tag: ${lastTag}"

# Bump the version
npm --no-git-tag-version version $lastTag

# Copy files to dist
cpx package.json dist
cpx README.md dist

# Publish to NPM
npm publish

以上是关于sh CircleCI部署到NPM的主要内容,如果未能解决你的问题,请参考以下文章

Heroku:错误 - /bin/sh:1:npm:部署到 Heroku 时未找到

使用 CircleCI 部署到 Firebase 托管

CircleCI 没有运行“npm run”命令

在 circleci 中缓存 npm 依赖项

sh 安装circleci docker

sh 使用CCMenu轮询CircleCI构建状态。