Skip to content

Instantly share code, notes, and snippets.

@parrots
Created April 9, 2015 01:28
Show Gist options
  • Select an option

  • Save parrots/d37f390d06114a4167c6 to your computer and use it in GitHub Desktop.

Select an option

Save parrots/d37f390d06114a4167c6 to your computer and use it in GitHub Desktop.

Revisions

  1. parrots created this gist Apr 9, 2015.
    13 changes: 13 additions & 0 deletions versioning.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    git=`sh /etc/profile; which git`
    branch_name=`$git symbolic-ref HEAD | sed -e 's,.*/\\(.*\\),\\1,'`
    git_count=`$git rev-list $branch_name |wc -l | sed 's/^ *//;s/ *$//'`
    simple_branch_name=`$git rev-parse --abbrev-ref HEAD`

    build_number="$git_count"
    if [ $CONFIGURATION != "Release" ]; then
    build_number+="-$simple_branch_name"
    fi

    plist="${SRCROOT}/WatchKit App/Info.plist"

    /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $build_number" "$plist"