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
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

on:
pull_request:
branches: [main]
push:
branches-ignore: [main]

jobs:
test:
name: Test
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Lint
run: npm run lint

- name: Run tests
run: npm run test:precommit

- name: Build
run: npm run build
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release

on:
push:
branches: [main]

jobs:
release:
name: Release
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm run test:precommit

- name: Build
run: npm run build

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm run semantic-release
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
build/
build/
mcp-open-library-*.tgz
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no -- commitlint --edit $1
13 changes: 13 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"branches": [
"main"
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/git",
"@semantic-release/github"
]
}
60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,73 @@ npm run inspector http://localhost:8080
- `npm test` - Run the test suite
- `npm run format` - Format code with Prettier
- `npm run inspector` - Run the MCP Inspector against the server
- `npm run semantic-release` - Run semantic release (automated in CI)

### Running Tests

```bash
npm test
```

### Releases

This project uses [semantic-release](https://semantic-release.gitbook.io/) for automated versioning and publishing. Releases are automatically created when commits are pushed to the `main` branch using [conventional commit messages](https://www.conventionalcommits.org/).

#### Required Secrets

For the automated release workflow to function, the following secrets must be configured in the GitHub repository:

- `GITHUB_TOKEN` - Automatically provided by GitHub Actions for creating releases and updating the repository
- `NPM_TOKEN` - Required for publishing packages to npm. Generate this token from your npm account with publish permissions

#### Commit Message Format

**⚠️ Important:** This project uses automated semantic versioning. The commit message format directly determines version bumps and changelog generation.

The project follows the [Conventional Commits](https://www.conventionalcommits.org/) specification. Each commit message must be structured as:

```
<type>[optional scope]: <description>

[optional body]

[optional footer(s)]
```

**Supported commit types:**
- `feat:` - new features (triggers **minor** version bump: 1.0.0 → 1.1.0)
- `fix:` - bug fixes (triggers **patch** version bump: 1.0.0 → 1.0.1)
- `feat!:` or `fix!:` - breaking changes (triggers **major** version bump: 1.0.0 → 2.0.0)
- `docs:`, `style:`, `refactor:`, `test:`, `chore:` - maintenance (no version bump)

**Examples:**
```
feat: add new search functionality
fix: resolve timeout issue in API calls
feat!: remove deprecated getBook method
docs: update API documentation
```

**Why this matters:**
- ✅ Proper format → Automatic version bump and release
- ❌ Wrong format → No release, manual intervention required
- 📝 Commit messages become the public changelog

The project validates commit messages automatically to ensure releases work correctly.

#### Development Workflow

The project includes automatic validation to ensure proper commit message format:

- **Pre-commit hooks** validate code quality with linting and tests
- **Commit message validation** ensures conventional commit format using [commitlint](https://commitlint.js.org/)
- **Invalid commit messages** are rejected before they reach the repository

To manually validate a commit message:
```bash
npm run commitlint
```

## Contributing

Contributions are welcome! Please feel free to submit a pull request.
Expand Down
23 changes: 23 additions & 0 deletions commitlint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [
2,
'always',
[
'feat',
'fix',
'docs',
'style',
'refactor',
'test',
'chore',
'revert'
]
],
'subject-case': [2, 'never', ['start-case', 'pascal-case', 'upper-case']],
'subject-empty': [2, 'never'],
'subject-full-stop': [2, 'never', '.'],
'header-max-length': [2, 'always', 72]
}
};
Loading