# Bump Version

This tool helps to increment the version number of a project.

You can download the tool here: [download.schukai.com/tools/version/](http://download.schukai.com/tools/version/).


```bash
echo "1.0.0" | version patch
# 1.0.1
echo "1.0.0" | version minor
# 1.1.0
echo "1.0.0" | version major
# 2.0.0
``` 

You can also replace directly in files.

**YAML**

```yaml
my:
  version: 1.0.0
```

```bash
version patch --path my.yaml --selector my.version
```

**JSON**

```json
{
  "my": {
    "version": "1.0.0"
  }
}
```

```bash
version patch --path my.json --selector my.version
```

**Git**

Or set git tags directly

```bash
version patch --git
```  

**Build**

With the command build the current build date can be output.

    
```bash 
version build
```

**Auto**

The 'auto' feature allows the tool to automatically determine the next version 
based on the project's git commit history since the last tag.

It uses semantic commit messages to determine the type of version bump. 
If a commit message starts with "feat:", it will trigger a minor version bump. 
If a commit message starts with "fix:" or if it includes "BREAKING CHANGE", 
it will trigger a patch or a major version bump respectively.

Here is how you can use the 'auto' feature:

```bash
version auto
``` 

This command implies the '--git' flag, which means that the tool will tag the
git repository with the new version. The tag name will be the new version number.

It is important to note that this feature requires that your commit messages 
follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) 
message format.

**Predict**

The `predict` command allows you to predict the next version based on the
project's git commit history since the last tag. Other than the `auto` command, 
this command does not write the result to a file or tag the git repository.

```bash
version predict
```


**Makefile**

```makefile

build: 
    version patch --path $(PROJECT_ROOT)version.json --selector "version"
    $(eval VERSION := $(shell cat version.json | jq -r .version))
    $(eval BUILD := $(shell version date))
    
    echo "Compiling for every OS and Platform $(VERSION) $(BUILD)"
```