@ajatamayo/add-two
v1.1.3
Published
A tiny private package that adds two numbers
Readme
add-two
Tiny package that adds two numbers.
Usage
Install (private package - authenticate first):
npm install @ajatamayo/add-twoAPI
const addTwo = require('@ajatamayo/add-two');
console.log(addTwo(2,3)); // 5CI / Bitbucket Pipeline
This repository includes Bitbucket Pipelines to publish releases to npm. There are three custom pipelines you can run from the Bitbucket UI:
release patch— bumps the patch version, commits and pushes, then publishes.release minor— bumps the minor version, commits and pushes, then publishes.release major— bumps the major version, commits and pushes, then publishes.
How to run
- In Bitbucket go to Pipelines → Run pipeline and select the custom pipeline you want (
release patch,release minor, orrelease major).
Required Repository Variables Set these in Repository settings → Pipelines → Repository variables (secure):
NPM_TOKEN— npm access token with permission to publish the package.GIT_EMAIL— email to use for the release commit (e.g.[email protected]).GIT_NAME— name to use for the release commit (e.g.ci-bot).
Behavior and notes
- The pipeline steps run
npm version <patch|minor|major>which updatespackage.jsonandpackage-lock.json, creates a git commit and a tag (e.g.v1.0.1). The pipeline then pushes the commit and tag back tomainand publishes to npm. - The commit message template is
Bump version to %s. - The build step uses the official
atlassian/npm-publishpipe which readsNPM_TOKENfor authentication. - Artifacts:
package.jsonandpackage-lock.jsonare passed between steps so the publish step uses the bumped version. - Ensure the pipeline runs on
mainor adjust the branch checks in the pipeline definitions.
Security
- Keep
NPM_TOKENas a secure repository variable (don't commit them to the repository). - Use scoped npm tokens with the least privilege necessary (publish only).
