Semantic Versioning

September 13, 2018

Semantic Versioning

The guide below will show you how to auto-increment the version of your application in any Git repository using Buddy's pipeline.

Actions used in this guide:

The pipeline we're about to create uses parameters to define which digit we want to raise (major/minor/patch), determines $latest_version with a script, and pushes the tag to your repository:

Pipeline examplePipeline example

1. Add Git repository

The first step is adding the repo with your project. In this example we'll use GitHub:

Creating a new projectCreating a new project

2. Configure pipeline settings

Now we can add the delivery pipeline. Let's configure it so that it runs on every push to the Master branch:

Adding a new pipelineAdding a new pipeline

3. Configure pipeline actions

3.1 Add environment variables

Before we get down to the actions we need to add a couple of variables that we'll use in a script later on. Switch to the Variables tab and add these three keys:

  • $major
  • $minor
  • $patch

Setting variablesSetting variables

  • Make sure to set the type to Settable as we need the action to remember the value before every execution.
  • Unless you already have a tag version in your repo, set all Values to zero.

3.2 Set version type

By default, the pipeline will increment the patch version (0.0.1) on every push. Let's add an action that will allow us to raise a minor (0.1.0) or major (1.0.0) number on manual trigger: Pass arguments.

Pass arguments actionPass arguments action

Add these two parameters:

  • $is_major
  • $is_minor

Defining parametersDefining parameters

The parameters can be either true or false. In this example we have uploaded a file with these values to the filesystem and selected them in the parameter options so we don't have to enter them manually every time the action is executed.

Trigger condition

Since we want to run this action only in manual mode, we need to set the Trigger condition. Enter the Condition tab in the action, set the condition to 'Run only if ENV VAR has specific value' and enter the values as follows:

Creating a trigger conditionCreating a trigger condition

From now on, whenever you run the pipeline manually, Buddy will ask you which version type you want to increase. If neither major nor minor is selected, the patch number will be incremented.

3.3 Set version number

The next step is adding an action with the versioning script. Select the Custom build action and paste the script below in the commands field. The script raises the selected version type by 1 and creates the tag for your commit:

if [ -n "$is_major" ] && ($is_major) ; then
elif [ -n "$is_minor" ] && ($is_minor) ; then
#add tag
git tag "$latest_version"

Environment configurationEnvironment configuration

Buddy uses isolated Docker containers to run build commands. The results are then saved to the filesystem and used across the whole pipeline.

3.4 Push the tag to the repository

With the version defined and tag created, we can finally push it to our project. Select the Git Push action and configure authentication details to your repository:

Action detailsAction details

You can also use environment variables to store sensitive data like server credentials.


When ready, make a push to your repository and check the results. Then, run the pipeline in manual mode: if everything's been configured correctly, Buddy will ask you for the version type and increment the tag in your repository:

GitHub panelGitHub panel

Buddy is 100% customer driven. If there’s a feature or integration you miss, let us know in the comments below or directly at

Alexander Kus

Alexander Kus

Customer Success Manager

A story-teller and conversation-lover, Alexander decided to invest his skills to help his friends at Buddy transform the cold language of patch notes into exciting narratives. Also: an avid gamer, hip-hop DJ, Liverpool FC fan, absentminded husband, and the father of two.

With Buddy even the most complicated CI/CD workflows take minutes to create

Sign up for Buddy CI/CD

Start a free trial

Trusted by customers from 170+ countries