fix(hooks): fix commit-msg validation and add pre-push failure banner… #64
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish to npm | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'package.json' | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22.x' | |
| registry-url: 'https://registry.npmjs.org/' | |
| - name: Upgrade npm for trusted publishing | |
| run: npm install -g npm@latest | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run tests | |
| run: npm test | |
| - name: Debug auth info | |
| run: | | |
| echo "npm version: $(npm --version)" | |
| echo "node version: $(node --version)" | |
| npm whoami 2>&1 || echo "Not logged in (expected for OIDC)" | |
| - name: Check version and publish | |
| run: | | |
| CURRENT_VERSION=$(node -p "require('./package.json').version") | |
| echo "🔍 Checking version: $CURRENT_VERSION" | |
| # Check if version exists on npm | |
| if npm view @nolrm/contextkit@$CURRENT_VERSION version > /dev/null 2>&1; then | |
| echo "⏭️ Version $CURRENT_VERSION already exists - skipping publish" | |
| echo "✅ No action needed" | |
| else | |
| echo "🚀 Publishing new version $CURRENT_VERSION..." | |
| npm publish --access public --provenance | |
| echo "✅ Successfully published @nolrm/contextkit@$CURRENT_VERSION" | |
| echo "📦 Package: https://www.npmjs.com/package/@nolrm/contextkit" | |
| echo "🚀 ContextKit is now available for installation!" | |
| echo "" | |
| echo "💡 To create a git tag manually:" | |
| echo " git tag v$CURRENT_VERSION" | |
| echo " git push origin v$CURRENT_VERSION" | |
| fi |