#!/bin/bash # Finds the next available r.. identifier for the current year and week YEAR_WEEK=$(date -u +%g.%-V) YEAR=${YEAR_WEEK:0:2} WEEK=${YEAR_WEEK:3} LAST_BUMP=$(git tag --list | grep '^r'$YEAR'\.'$WEEK'\.\(0\|[1-9][0-9]*\)$' | cut -d . -f 3 | sort -nr | head -n 1) RELEASE=r${YEAR_WEEK}.$(( ${LAST_BUMP:--1} + 1 )) git tag $RELEASE echo Tagged $RELEASE