Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,25 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'

- name: Setup .npmrc with authentication
- name: Configure npm authentication
run: |
npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
npm config set registry https://registry.npmjs.org/
npm config set always-auth true

- name: Debug - Check .npmrc content
run: |
echo "Contents of .npmrc:"
cat ~/.npmrc | sed 's/_authToken=.*/_authToken=***HIDDEN***/'
echo "NPM config:"
npm config list
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Debug - Verify authentication
run: |
echo "Checking npm authentication:"
npm whoami
echo "Checking package ownership:"
npm owner ls usagey
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Install dependencies
run: npm ci
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Run tests
run: npm test
Expand All @@ -51,6 +47,8 @@ jobs:
run: |
PUBLISHED_VERSION=$(npm view usagey version 2>/dev/null || echo "0.0.0")
echo "version=$PUBLISHED_VERSION" >> $GITHUB_OUTPUT
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Compare versions
id: version_check
Expand All @@ -68,6 +66,8 @@ jobs:
echo "No version change - skipping publish"
fi

- name: Publish to npm with explicit registry
- name: Publish to npm
if: steps.version_check.outputs.should_publish == 'true'
run: npm publish --registry https://registry.npmjs.org/ --access public
run: npm publish --access public
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Loading