npm NPM Authentication

Publish packages to npm registry or GitHub Packages

Option 1: Pass Token as Input

- uses: a-line-services/release-pilot@v1
  with:
    github-token: ${{ secrets.GITHUB_TOKEN }}
    npm-token: ${{ secrets.NPM_TOKEN }}

Getting an NPM Token

  1. Go to npmjs.com/settings/tokens
  2. Click "Generate New Token" → "Classic Token"
  3. Select "Automation" type
  4. Copy the token and add it as NPM_TOKEN secret in your repo

Option 2: Pre-configure .npmrc

If you need more control over npm configuration:

- uses: actions/setup-node@v4
  with:
    node-version: 20
    registry-url: 'https://registry.npmjs.org'

- uses: a-line-services/release-pilot@v1
  with:
    github-token: ${{ secrets.GITHUB_TOKEN }}
  env:
    NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

GitHub Packages

To publish to GitHub Packages instead of npm:

- uses: a-line-services/release-pilot@v1
  with:
    github-token: ${{ secrets.GITHUB_TOKEN }}
    npm-token: ${{ secrets.GITHUB_TOKEN }}
    npm-registry: 'https://npm.pkg.github.com'
Note
Your package.json must have the correct scope:
{
  "name": "@your-org/your-package",
  "publishConfig": {
    "registry": "https://npm.pkg.github.com"
  }
}

Private Registries

For private npm registries (Verdaccio, Artifactory, etc.):

- uses: a-line-services/release-pilot@v1
  with:
    github-token: ${{ secrets.GITHUB_TOKEN }}
    npm-token: ${{ secrets.PRIVATE_NPM_TOKEN }}
    npm-registry: 'https://npm.your-company.com'

Inputs Reference

Input Description Default
npm-token NPM authentication token -
npm-registry NPM registry URL https://registry.npmjs.org