Skip to content

Instantly share code, notes, and snippets.

View mrgreyves's full-sized avatar

Vladimir Drozdetskiy mrgreyves

View GitHub Profile
@mrgreyves
mrgreyves / auto-increment-version.sh
Created August 20, 2021 15:25 — forked from CSTDev/auto-increment-version.sh
Script that will find the last Git Tag and increment it. It will only increment when the latest commit does not already have a tag. By default it increments the patch number, you can tell it to change the major or minor versions by adding #major or #minor to the commit message.
#!/bin/bash
#get highest tag number
VERSION=`git describe --abbrev=0 --tags`
#replace . with space so can split into an array
VERSION_BITS=(${VERSION//./ })
#get number parts and increase last one by 1
VNUM1=${VERSION_BITS[0]}