Skip to content

Instantly share code, notes, and snippets.

@ctreffs
Created February 5, 2021 13:37
Show Gist options
  • Save ctreffs/7d46dba61821a720a4d643cd4fb0a226 to your computer and use it in GitHub Desktop.
Save ctreffs/7d46dba61821a720a4d643cd4fb0a226 to your computer and use it in GitHub Desktop.
Get version string from git
#!/bin/sh
GIT=$1
if [[ -z $GIT ]]; then
GIT=git
fi
## Use the last annotated 'develop' tag as CFBundleShortVersionString
version=`"${GIT}" tag --merged HEAD --list 'develop/*' --sort=v:refname | tail -n 1`
printf `echo $version | sed 's/\-[0-9]*\-[a-zA-Z0-9]*//' | sed 's/develop\///'`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment