Automate publishing a Node.js package to Buildkite
Publish a Node.js package to your Buildkite repository.
Use template →1env:
2 PACKAGE_NAME: "example-package"
3 AUTH_TOKEN: "package-auth-token"
4
5steps:
6 - label: ":npm: package"
7 key: package
8 command: npm pack
9 artifact_paths:
10 - "example-project-*.tgz"
11 plugins:
12 - docker#v5.9.0:
13 image: "node:20.11"
14
15 - label: ":npm: publish"
16 depends_on: package
17 commands:
18 - npm set "//buildkitepackages.com/${BUILDKITE_ORGANIZATION_SLUG}/${PACKAGE_NAME}/npm/:_authToken" ${AUTH_TOKEN}
19 - npm set registry "https://buildkitepackages.com/${BUILDKITE_ORGANIZATION_SLUG}/${PACKAGE_NAME}/npm/"
20 - npm publish
21 plugins:
22 - docker#v5.9.0:
23 image: "node:20.11"
24 - artifacts#v1.9.3:
25 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.