This guide explains how to publish the auth package to npm and GitHub Packages.
The auth package is configured for publishing to:
- npm: Published as
cortex-auth(manual via script) - GitHub Packages: Published as
@cortex-reply/auth(automatic via GitHub Actions)
- Go to npmjs.com
- Create an account if you don't have one
- Navigate to Access Tokens → Generate New Token
- Choose "Automation" or "Publish" level access
- Add as a GitHub Actions secret named
NPM_TOKEN
The GITHUB_TOKEN is automatically provided by GitHub Actions for publishing to GitHub Packages.
# Set your npm token
export NPM_TOKEN=<your-npm-token>
# Run from the root directory
bash scripts/publish-auth.shPublishing to GitHub Packages happens automatically via GitHub Actions workflow when you create a tag matching auth-v*.
# Create a release tag
git tag auth-v0.0.2
git push origin auth-v0.0.2This will trigger the workflow defined in .github/workflows/publish-auth.yml.
Go to Actions → "Publish Auth Package" → Run workflow → Select branch and click "Run workflow"
npm install cortex-auth
# or
yarn add cortex-auth
# or
pnpm add cortex-authAdd to .npmrc:
@cortex-reply:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=<your-github-token>
Then install:
npm install @cortex-reply/auth
# or
yarn add @cortex-reply/auth
# or
pnpm add @cortex-reply/auth- name:
cortex-auth(for npm) - publishConfig: Specifies npm registry and public access
- repository: Links to the GitHub repository with the package directory
- keywords: Helps with npm discoverability
The .npmrc file in packages/auth/ handles:
- Routing
@cortex-replyscope to GitHub Packages - Using the
GITHUB_TOKENenvironment variable for authentication - Default registry pointing to npm
- Verify
NPM_TOKENis set correctly for npm publishing - GitHub token is automatically provided by GitHub Actions
- Increment the version in
packages/auth/package.json - Create a new tag for GitHub Packages:
git tag auth-v<new-version>
- Verify the tag matches the pattern
auth-v* - Check workflow permissions in repository settings
- Go to Settings → Secrets and variables → Actions
- Click "New repository secret"
- Add
NPM_TOKENwith your npm token value - GitHub provides
GITHUB_TOKENautomatically
The GitHub Actions workflow (.github/workflows/publish-auth.yml):
- Triggers on tags matching
auth-v*or manual workflow dispatch - Checks out the code
- Sets up Node.js with GitHub Packages registry
- Installs dependencies
- Builds the auth package
- Temporarily updates the package name to
@cortex-reply/auth - Publishes to GitHub Packages
- Restores the original package name
- Creates a GitHub Release