GitHub Actions¶
You can use private Capawesome npm packages within your GitHub Actions workflows 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 GitHub Secret¶
Get your license key and add it to your GitHub repository as an encrypted secret with the name CAPAWESOME_NPM_REGISTRY_TOKEN
as described in Creating encrypted secrets for a repository.
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.
Workflow Configuration¶
Configure the npm registry¶
Add the following step to your GitHub Actions workflow before installing npm dependencies:
- name: Configure the Capawesome npm registry
run: |
echo "@capawesome-team:registry=https://npm.registry.capawesome.io" >> .npmrc
echo "//npm.registry.capawesome.io/:_authToken=${{ secrets.CAPAWESOME_NPM_REGISTRY_TOKEN }}" >> .npmrc
This will automatically configure npm to use the Capawesome registry for @capawesome-team
packages during GitHub Actions builds.
Example¶
Here's a complete example of a GitHub Actions workflow that builds an Ionic app using private Capawesome packages:
name: Build App
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
- name: Configure the Capawesome npm registry
run: |
echo "@capawesome-team:registry=https://npm.registry.capawesome.io" >> .npmrc
echo "//npm.registry.capawesome.io/:_authToken=${{ secrets.CAPAWESOME_NPM_REGISTRY_TOKEN }}" >> .npmrc
- name: Install Dependencies
run: npm ci
- name: Sync Capacitor
run: npx cap sync
- name: Build web assets
run: npm run build
This workflow will authenticate with the Capawesome npm registry and install any private packages specified in your package.json
file.