Skip to content

Azure DevOps

You can use private Capawesome npm packages within your Azure Pipelines 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 an Azure Pipeline Variable

Get your license key and add it to your Azure Pipeline as a secret variable with the name CAPAWESOME_NPM_REGISTRY_TOKEN as described in Set secret variables. Make sure to mark the variable as secret.

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 steps to your Azure Pipeline before installing npm dependencies:

- script: echo "@capawesome-team:registry=https://npm.registry.capawesome.io" >> .npmrc
  displayName: Configure Capawesome npm registry
- script: echo "//npm.registry.capawesome.io/:_authToken=$(CAPAWESOME_NPM_REGISTRY_TOKEN)" >> .npmrc
  displayName: Authenticate with Capawesome registry

This will automatically configure npm to use the Capawesome registry for @capawesome-team packages during Azure DevOps builds.

Example

Here's a complete example of an azure-pipelines.yml file that builds an Ionic app using private Capawesome packages:

trigger:
- main

pool:
  vmImage: ubuntu-latest

variables:
  - name: nodeVersion
    value: '20.x'

jobs:
- job: Build
  displayName: Build App
  steps:
  - checkout: self
    displayName: Checkout Repository
  - task: UseNode@1
    inputs:
      version: $(nodeVersion)
    displayName: Setup Node.js $(nodeVersion)
  - script: echo "@capawesome-team:registry=https://npm.registry.capawesome.io" >> .npmrc
    displayName: Configure Capawesome npm registry
  - script: echo "//npm.registry.capawesome.io/:_authToken=$(CAPAWESOME_NPM_REGISTRY_TOKEN)" >> .npmrc
    displayName: Authenticate with Capawesome registry
  - script: npm ci
    displayName: Install Dependencies
  - script: npx cap sync
    displayName: Sync Capacitor
  - script: npm run build
    displayName: Build App
  - task: PublishBuildArtifacts@1
    inputs:
      pathtoPublish: 'dist'
      artifactName: 'build-output'
    displayName: Publish Build Artifacts