npm へのデプロイ

You can use Bitbucket Pipelines to build, test and publish your npm package.

You can use the feature of pushing back to your repository from within your pipeline to update the tag.

Be sure to include [skip ci] in the commit message of your version bump to avoid an infinite loop of builds!

Use the npm publish pipe to publish the package to the npm registry. To publish to a private npm package, edit your package.json to add a section like the example below.

package.json
{
  "name": "package",
  "version": "1.0.11",
  "description": "Description",
  "publishConfig":{"registry":"my-internal-registry.local"}
}

There are even more examples in the pipe repository of how to use the pipe with npm.

For this example, we need to add the $NPM_TOKEN variable in Bitbucket.

bitbucket-pipelines.yml
image: node:10.15.1

pipelines:
  default:
    - step:
        name: Build and Test
        script:
          - npm install
          - npm test
    - step:
        name: Publish
        deployment: production
        script:
          - npm version minor -m "Upgrade to %s [skip ci]"
          - git push && git push --tags
          - pipe: atlassian/npm-publish:0.2.0
            variables:
              NPM_TOKEN: $NPM_TOKEN
最終更新日: 2019 年 2 月 27 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.