Skip to content

ci: fix OIDC auth by removing registry-url #26

ci: fix OIDC auth by removing registry-url

ci: fix OIDC auth by removing registry-url #26

Workflow file for this run

name: Publish Package and Create Release
on:
push:
tags:
- 'v*'
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install dependencies
run: npm ci
- name: Configure npm for publishing
run: npm config set registry https://registry.npmjs.org/
- name: Get version from tag
id: version
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Verify package.json version matches tag
run: |
PKG_VERSION=$(node -p "require('./package.json').version")
TAG_VERSION=${{ steps.version.outputs.version }}
if [ "$PKG_VERSION" != "$TAG_VERSION" ]; then
echo "❌ Version mismatch: package.json ($PKG_VERSION) != tag ($TAG_VERSION)"
exit 1
fi
echo "✅ Version verified: $PKG_VERSION"
- name: Test package
run: npm test || echo "No tests specified"
- name: Publish to npm (Trusted Publishing)
run: npm publish --provenance --access public
- name: Setup Node.js for GitHub Packages
uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://npm.pkg.github.com'
- name: Configure package for GitHub Packages
run: |
cp package.json package.json.backup
node -e "
const pkg = require('./package.json');
pkg.name = '@evanlong-me/claude-code-usage';
pkg.publishConfig = { registry: 'https://npm.pkg.github.com' };
require('fs').writeFileSync('package.json', JSON.stringify(pkg, null, 2));
"
- name: Publish to GitHub Packages
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ github.token }}
- name: Restore original package.json
run: mv package.json.backup package.json
- name: Generate changelog
id: changelog
run: |
echo "changelog<<EOF" >> $GITHUB_OUTPUT
PREV_TAG=$(git describe --tags --abbrev=0 HEAD~1 2>/dev/null || echo "")
if [ -n "$PREV_TAG" ]; then
git log --pretty=format:"- %s" $PREV_TAG..HEAD >> $GITHUB_OUTPUT
else
git log --pretty=format:"- %s" -10 >> $GITHUB_OUTPUT
fi
echo "" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.version.outputs.version }}
name: Release v${{ steps.version.outputs.version }}
body: |
## Changes in v${{ steps.version.outputs.version }}
${{ steps.changelog.outputs.changelog }}
## Installation
```bash
npm install -g claude-code-usage
```
## Usage
```bash
ccu
```
draft: false
prerelease: false