146 lines
3.4 KiB
Markdown
146 lines
3.4 KiB
Markdown
# Conventional Commits Examples
|
|
|
|
This file contains examples of conventional commits that will trigger automatic releases.
|
|
|
|
## Commit Types
|
|
|
|
### `feat:` - New Features (Minor Release)
|
|
|
|
```bash
|
|
# Add new video format support
|
|
git commit -m "feat: add support for MP4 video format"
|
|
|
|
# Add new command
|
|
git commit -m "feat: add /help command for user assistance"
|
|
|
|
# Add new language support
|
|
git commit -m "feat: add Spanish language support"
|
|
```
|
|
|
|
### `fix:` - Bug Fixes (Patch Release)
|
|
|
|
```bash
|
|
# Fix download issue
|
|
git commit -m "fix: resolve video download timeout issue"
|
|
|
|
# Fix memory leak
|
|
git commit -m "fix: prevent memory leak in video processing"
|
|
|
|
# Fix error handling
|
|
git commit -m "fix: improve error handling for invalid URLs"
|
|
```
|
|
|
|
### `feat!:` or `fix!:` - Breaking Changes (Major Release)
|
|
|
|
```bash
|
|
# Breaking change in API
|
|
git commit -m "feat!: change bot command structure"
|
|
|
|
# Breaking change in configuration
|
|
git commit -m "fix!: update environment variable names"
|
|
```
|
|
|
|
### `docs:` - Documentation (No Release)
|
|
|
|
```bash
|
|
# Update README
|
|
git commit -m "docs: update installation instructions"
|
|
|
|
# Add API documentation
|
|
git commit -m "docs: add API endpoint documentation"
|
|
```
|
|
|
|
### `style:` - Code Style (No Release)
|
|
|
|
```bash
|
|
# Format code
|
|
git commit -m "style: format code according to prettier"
|
|
|
|
# Fix linting issues
|
|
git commit -m "style: fix ESLint warnings"
|
|
```
|
|
|
|
### `refactor:` - Code Refactoring (No Release)
|
|
|
|
```bash
|
|
# Refactor download logic
|
|
git commit -m "refactor: improve video download performance"
|
|
|
|
# Restructure code
|
|
git commit -m "refactor: reorganize bot handlers"
|
|
```
|
|
|
|
### `test:` - Testing (No Release)
|
|
|
|
```bash
|
|
# Add unit tests
|
|
git commit -m "test: add unit tests for download function"
|
|
|
|
# Update test configuration
|
|
git commit -m "test: update test environment setup"
|
|
```
|
|
|
|
### `chore:` - Maintenance (No Release)
|
|
|
|
```bash
|
|
# Update dependencies
|
|
git commit -m "chore: update dependencies to latest versions"
|
|
|
|
# Update CI configuration
|
|
git commit -m "chore: update GitHub Actions workflow"
|
|
|
|
# Manual release
|
|
git commit -m "chore: release 1.0.0" -m "Release-As: 1.0.0"
|
|
```
|
|
|
|
## Commit Message Format
|
|
|
|
```
|
|
<type>[optional scope]: <description>
|
|
|
|
[optional body]
|
|
|
|
[optional footer(s)]
|
|
```
|
|
|
|
### Examples with Scope
|
|
|
|
```bash
|
|
# With scope
|
|
git commit -m "feat(download): add support for batch downloads"
|
|
|
|
# With scope and body
|
|
git commit -m "feat(api): add rate limiting" -m "Add rate limiting to prevent abuse"
|
|
|
|
# With breaking change
|
|
git commit -m "feat(api)!: change response format" -m "BREAKING CHANGE: API response structure has changed"
|
|
```
|
|
|
|
## Version Bumping Rules
|
|
|
|
- **Patch (1.0.0 → 1.0.1)**: `fix:`, `docs:`, `style:`, `refactor:`, `test:`, `chore:`
|
|
- **Minor (1.0.0 → 1.1.0)**: `feat:`
|
|
- **Major (1.0.0 → 2.0.0)**: `feat!:` or `fix!:` (breaking changes)
|
|
|
|
## Best Practices
|
|
|
|
1. **Use present tense**: "add" not "added"
|
|
2. **Use imperative mood**: "move cursor" not "moves cursor"
|
|
3. **Don't capitalize the first letter**: "fix: resolve issue" not "Fix: resolve issue"
|
|
4. **Don't end with a period**: "feat: add new feature" not "feat: add new feature."
|
|
5. **Be descriptive**: "fix: resolve memory leak in video processing" not "fix: bug"
|
|
|
|
## Testing Commits
|
|
|
|
To test the release process without affecting production:
|
|
|
|
```bash
|
|
# Create a test commit
|
|
git commit -m "test: add test feature for release testing"
|
|
|
|
# Push to trigger release-please
|
|
git push origin master
|
|
|
|
# Check the created PR in GitHub
|
|
# If satisfied, merge the PR to create a release
|
|
``` |