Skip to content
Merged
Show file tree
Hide file tree
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
52 changes: 52 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Publish to npm

on:
workflow_dispatch:
push:
branches:
- main
paths:
- "package.json"

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- uses: actions/setup-node@v6
with:
node-version: 22.x
registry-url: "https://registry.npmjs.org"

- name: Install dependencies
run: npm install --frozen-lockfile

- name: Lint
run: npm run lint

- name: Test
run: npm run test
env:
CI: true

- name: Build
run: npm run build

- name: Verify dist contents
run: |
echo "Contents of packages/react-hotkeys-hook/dist/:"
ls -la packages/react-hotkeys-hook/dist/
if [ ! -f packages/react-hotkeys-hook/dist/index.js ]; then
echo "ERROR: dist/index.js not found"
exit 1
fi
if [ ! -f packages/react-hotkeys-hook/dist/index.d.ts ]; then
echo "ERROR: dist/index.d.ts not found"
exit 1
fi

- name: Publish to npm
run: npm publish --tolerate-republish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
86 changes: 86 additions & 0 deletions .github/workflows/version-bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Version Bump

on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- "packages/react-hotkeys-hook/**"
- ".github/workflows/publish.yml"

permissions:
contents: write
pull-requests: write

jobs:
version-bump:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-version-bump') }}
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.head_ref }}
fetch-depth: 0

- uses: actions/setup-node@v6
with:
node-version: 22.x

- name: Install Claude Code
run: npm install -g @anthropic-ai/claude-code

- name: Run Claude Version Bump Analysis
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
claude --dangerously-skip-permissions --model sonnet -p "
You are analyzing PR #${{ github.event.pull_request.number }} for @humanlayer/react-hotkeys-hook version bump.

## Context
- Package: root package.json (publishes from packages/react-hotkeys-hook/dist)
- Package name: @humanlayer/react-hotkeys-hook
- PR Title: ${{ github.event.pull_request.title }}

## Instructions

1. Read the PR diff using: gh pr diff ${{ github.event.pull_request.number }}
2. Read the commit messages using: gh pr view ${{ github.event.pull_request.number }} --json commits
3. Check the current version: cat package.json | jq -r '.version'
4. Check if version differs from base branch: git show origin/${{ github.base_ref }}:package.json | jq -r '.version'

## Decision Logic

If the user ALREADY bumped the version (current != base):
- Analyze whether you agree with their bump level
- If you agree: explain why their choice is correct
- If you disagree: explain what bump level you would recommend and why
- DO NOT make any changes - just provide your analysis

If the user has NOT bumped the version (current == base):
- Determine the appropriate bump level based on changes:
- MAJOR: Breaking API changes, removed exports, changed hook signatures
- MINOR: New features, new exports, new options (backwards compatible)
- PATCH: Bug fixes, documentation, refactoring, dependency updates
- Bump BOTH package.json files:
- npm version <major|minor|patch> --no-git-tag-version
- cd packages/react-hotkeys-hook && npm version <major|minor|patch> --no-git-tag-version
- Commit: git add package.json packages/react-hotkeys-hook/package.json && git commit -m 'chore: bump @humanlayer/react-hotkeys-hook to <new-version>'
- Push: git push

## Final Output

End your response with a clear summary formatted like:

## Version Bump Summary

**Package**: @humanlayer/react-hotkeys-hook
**Action**: <bumped to X.Y.Z | agreed with user bump to X.Y.Z | recommend <type> instead of user's <type> | no changes needed>
**Reasoning**: <brief explanation of why this bump level is appropriate based on the changes>
" 2>&1 | tee CLAUDE_OUTPUT.md

- name: Comment on PR
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr comment ${{ github.event.pull_request.number }} --body-file CLAUDE_OUTPUT.md --edit-last || \
gh pr comment ${{ github.event.pull_request.number }} --body-file CLAUDE_OUTPUT.md
15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "react-hotkeys-hook",
"description": "React hook for handling keyboard shortcuts",
"version": "5.2.4",
"name": "@humanlayer/react-hotkeys-hook",
"description": "React hook for handling keyboard shortcuts (HumanLayer fork)",
"version": "5.2.5",
"sideEffects": false,
"repository": {
"type": "git",
"url": "https://github.com/JohannesKlauss/react-keymap-hook.git"
"url": "https://github.com/humanlayer/react-hotkeys-hook.git"
},
"homepage": "https://react-hotkeys-hook.vercel.app/",
"homepage": "https://github.com/humanlayer/react-hotkeys-hook",
"author": "Johannes Klauss",
"type": "module",
"main": "packages/react-hotkeys-hook/dist/index.js",
Expand All @@ -32,7 +32,7 @@
"build": "npm run -w packages/react-hotkeys-hook build",
"build:documentation": "npm run -w packages/documentation build",
"test": "npm run -w packages/react-hotkeys-hook test",
"prepublishOnly": "npm run test && npm run lint && npm run build",
"prepack": "npm run build",
"format": "npx @biomejs/biome format --write packages",
"lint": "npx @biomejs/biome lint --write packages"
},
Expand All @@ -43,6 +43,9 @@
"react": ">=16.8.0",
"react-dom": ">=16.8.0"
},
"publishConfig": {
"access": "public"
},
"devDependencies": {
"@biomejs/biome": "2.3.11"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/react-hotkeys-hook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-hotkeys-hook",
"version": "5.2.4",
"version": "5.2.5",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down