Skip to content

AhmedUKamel/Semantic-Versioning-Decision-Tree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“ฆ Semantic Versioning Decision Tree

An interactive tool to help you determine the correct semantic version bump for your project. Choose between MAJOR, MINOR, or PATCH version updates using a guided decision tree.

๐ŸŽฏ What is Semantic Versioning?

Semantic Versioning (SemVer) uses a three-part version number: MAJOR.MINOR.PATCH (e.g., 1.2.3)

  • MAJOR (X.0.0): Breaking changes that are incompatible with previous versions
  • MINOR (X.Y.0): New features added in a backwards-compatible manner
  • PATCH (X.Y.Z): Bug fixes and internal improvements without API changes

Learn more at semver.org

๐Ÿš€ Quick Start

Option 1: Interactive Web Interface

The web interface is automatically deployed to GitHub Pages. Access it here:

๐ŸŒ Live Demo

Or open docs/index.html locally in your browser:

open docs/index.html
# or
firefox docs/index.html

The web interface is automatically deployed when you push changes to the docs/ directory using GitHub Actions.

Option 2: Bash Command Line

Make the script executable and run it:

chmod +x semver.sh
./semver.sh

Answer each question with Y (Yes) or N (No), and the tool will determine your next version.

๐Ÿ“‹ How It Works

The decision tree guides you through these questions:

  1. Have you made ANY changes to your project?

    • No โ†’ PATCH (no version bump)
    • Yes โ†’ Continue
  2. Have you made breaking changes? (non-backwards compatible)

    • Yes โ†’ MAJOR โœ…
    • No โ†’ Continue
  3. Have you added NEW features? (backwards compatible)

    • Yes โ†’ MINOR โœ…
    • No โ†’ Continue
  4. Have you only fixed bugs or improved performance?

    • Yes โ†’ PATCH โœ…
    • No โ†’ Continue
  5. Are your changes INTERNAL ONLY? (tests, docs, build process)

    • Yes โ†’ PATCH โœ…
    • No โ†’ Continue
  6. Are you unsure?

    • Yes โ†’ MINOR (safer default) โœ…
    • No โ†’ PATCH (minimal changes)

๐Ÿ“ Files Included

.
โ”œโ”€โ”€ LICENSE             # MIT License
โ”œโ”€โ”€ README.md           # This file
โ”œโ”€โ”€ semver.sh           # Bash command-line tool
โ””โ”€โ”€ docs/
    โ””โ”€โ”€ index.html      # Interactive web interface (deployed via GitHub Pages)

๐Ÿ’ป Requirements

For Web Interface

  • Any modern web browser (Chrome, Firefox, Safari, Edge, etc.)
  • No installation or dependencies needed
  • Access via GitHub Pages or local file

For Bash CLI Tool

  • Bash shell (v3.0+)
  • Linux, macOS, or Windows (with WSL/Git Bash)

๐Ÿ”ง Setup & Deployment

GitHub Pages Setup

This project uses GitHub Actions to automatically deploy the web interface from the docs/ directory:

  1. Enable GitHub Pages in your repository settings:

    • Go to Settings โ†’ Pages
    • Select "Deploy from a branch"
    • Choose main branch and /docs folder
    • Save
  2. GitHub Actions automatically deploys your changes when you push to the repository

  3. Access your live demo at: https://ahmedukamel.github.io/Semantic-Versioning-Decision-Tree/

The web interface will be updated automatically with each push to the repository!

๐ŸŽฎ Usage Examples

Web Interface

  1. Open index.html in your browser
  2. Answer Yes/No questions
  3. Get your version recommendation with detailed explanation
  4. Click "Start Over" to analyze another change

Bash Interface

$ ./semver.sh

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘     ๐Ÿ“ฆ Semantic Versioning Helper      โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

Path: Start
Progress: [โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘] 0%

Have you made ANY changes to your project?
[Y/N]: Y

# ... continue answering questions ...

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘      ๐ŸŸข MINOR VERSION BUMP             โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

Decision: MINOR Version Bump

You've added new backwards-compatible features.
Increment the second number: X.Y โ†’ X.(Y+1).0

Format: MAJOR.MINOR.PATCH (e.g., 1.2.3)

๐Ÿ†˜ Command Line Options

./semver.sh -h          # Show help
./semver.sh --help      # Show help
./semver.sh -v          # Show version
./semver.sh --version   # Show version

๐Ÿ“– Decision Guide

When to Use MAJOR (๐Ÿ”ด)

  • Removing or renaming public API methods
  • Changing function signatures
  • Modifying data structures in incompatible ways
  • Breaking changes to configuration format
  • Example: 1.0.0 โ†’ 2.0.0

When to Use MINOR (๐ŸŸข)

  • Adding new features
  • Adding new public API methods
  • Deprecating features (with warnings)
  • Performance improvements without API changes
  • Example: 1.2.0 โ†’ 1.3.0

When to Use PATCH (๐Ÿ”ต)

  • Fixing bugs
  • Security patches
  • Minor performance improvements
  • Updating dependencies for internal use
  • Documentation updates
  • Example: 1.2.3 โ†’ 1.2.4

๐Ÿ”„ Version Bump Examples

Change Current New
Bug fix 1.2.3 1.2.4
New feature 1.2.3 1.3.0
Breaking change 1.2.3 2.0.0
Multiple fixes 1.2.3 1.2.5
Multiple features 1.2.3 1.4.0

๐Ÿ’ก Best Practices

  • Always reset MINOR and PATCH to 0 when bumping MAJOR

    • 1.5.3 โ†’ 2.0.0 (not 2.5.3)
  • Reset PATCH to 0 when bumping MINOR

    • 1.2.5 โ†’ 1.3.0 (not 1.3.5)
  • Use pre-release versions for testing before release

    • 2.0.0-beta.1, 2.0.0-rc.1
  • Document breaking changes clearly in your changelog

    • Help users understand what needs to update
  • When in doubt, choose MINOR over MAJOR

    • It's more conservative and safer for users

๐Ÿค Contributing

Found an issue or want to improve this tool? Feel free to submit issues or pull requests!

๐Ÿ“ License

This project is open source and available under the MIT License.

๐Ÿ”— Resources


Made with โค๏ธ by Ahmed Kamel

ยฉ 2025 Ahmed Kamel. All rights reserved.

Licensed under the MIT License - see LICENSE file for details.