Bitbucket Pipelines¶
You can use private Capawesome npm packages within your Bitbucket Pipelines builds by configuring the Capawesome npm registry. This guide shows you how to set up authentication to access the private packages from the Capawesome Insiders program.
Preparation¶
Create a Bitbucket Repository Variable¶
Get your license key and add it to your Bitbucket repository as a secured repository variable with the name CAPAWESOME_NPM_REGISTRY_TOKEN
as described in Variables and secrets. Make sure to mark the variable as secured.
Keep your license key secure
Never commit your license key directly to your repository and always use environment variables to store sensitive information like authentication tokens.
Pipeline Configuration¶
Configure the npm registry¶
Add the following script to your Bitbucket Pipeline before installing npm dependencies:
- echo "@capawesome-team:registry=https://npm.registry.capawesome.io" >> .npmrc
- echo "//npm.registry.capawesome.io/:_authToken=${CAPAWESOME_NPM_REGISTRY_TOKEN}" >> .npmrc
This will automatically configure npm to use the Capawesome registry for @capawesome-team
packages during Bitbucket Pipelines builds.
Example¶
Here's a complete example of a bitbucket-pipelines.yml
file that builds an Ionic app using private Capawesome packages:
image: node:20
pipelines:
default:
- step:
name: Build App
caches:
- node
script:
- echo "@capawesome-team:registry=https://npm.registry.capawesome.io" >> .npmrc
- echo "//npm.registry.capawesome.io/:_authToken=${CAPAWESOME_NPM_REGISTRY_TOKEN}" >> .npmrc
- npm ci
- npx cap sync
- npm run build
artifacts:
- dist/**