Automate publishing a Node.js package to Buildkite
Publish a Node.js package to your Buildkite repository.
Use template →env:
  PACKAGE_NAME: "example-package"
  AUTH_TOKEN: "package-auth-token"
steps:
  - label: ":npm: package"
    key: package
    command: npm pack
    artifact_paths:
      - "example-project-*.tgz"
    plugins:
      - docker#v5.9.0:
          image: "node:20.11"
  - label: ":npm: publish"
    depends_on: package
    commands:
      - npm set "//buildkitepackages.com/${BUILDKITE_ORGANIZATION_SLUG}/${PACKAGE_NAME}/npm/:_authToken" ${AUTH_TOKEN}
      - npm set registry "https://buildkitepackages.com/${BUILDKITE_ORGANIZATION_SLUG}/${PACKAGE_NAME}/npm/"
      - npm publish
    plugins:
      - docker#v5.9.0:
          image: "node:20.11"
      - artifacts#v1.9.3:
          download: "example-project-*.tgz"- Languages
 - JavaScript
 - Use cases
 - Packages, Continuous integration
 - Tools
 - npm
 
Publish Node.js package to Buildkite
Publish a Node.js package to your Buildkite repository.
Use template →Automate publishing a Node.js package to Buildkite
This template gives you a continuous integration (CI) pipeline that automates publishing a Node.js package to a Buildkite package repository.
At a glance:
- For Node.js projects
 - For Buildkite Packages
 - Requires Docker
 
How it works
This template:
- Packages a project using npm.
 - Configures npm and publishes the package to your Buildkite package registry.
 
Next steps
After you select Use template, you’ll:
- Connect the Git repository for your Node.js project.
 - Configure Buildkite with the following environment: 
PACKAGE_NAME,AUTH_TOKEN. - Configure the compute—run locally, on-premises, or in the cloud.
 - Run the pipeline.
 
You can then play around with the pipeline settings. For example, run the pipeline locally while you iterate on the definition or set a schedule to trigger a nightly build.
If you need help, please check our documentation, raise an issue , or reach out to support.