denal05 / GitVersioningOnXCode

Pretty Xcode Git versioning for iOS & macOS applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pretty Xcode Git versioning for iOS & macOS applications

Platform Stackoverflow

iOS Git versioning example

A few simple steps to make versioning more understandable

Features

  • Every version string consists of 2 parts: Bundle Version String (from Info.plist file) and Git commit SHA1 (you always can find this commit in the repository timeline).

  • You can display your unique app version on the splash screen or on the about screen.

  • When you sending yet another build to your customers or testers, you're not afraid to get lost in application versions. Every bug or wish will be binded with the version code.

  • Your AppStore users can send feedbacks from the special form and every message will be signed with the unique version code.

How does it work?

This shell script runs every time you building your application. As the result - value of the macros GIT_SHA_VERSION (from GitVersion.swift) updates with the SHA1-code of the last branch commit.

Installation Guide

  1. Open Build Phases in Xcode

  2. Press Add Build Phase

  3. Press Add Run Script Build Phase. You can find this in the top menu Editor. Drag script-line to the position after Target Dependencies.

  4. Set Shell line to /bin/sh

  5. Set contents of the gitversioning.sh (without first #-lines) to the script field. Don't forget to change Sources to your path-to-file, where GitVersion.swift should be. For example: Adding new Build Phase

  6. Add the autogenerated GitVersion.swift file into Xcode project

  7. Paste these lines:

let myCFBundleShortVersionString = Bundle.main.infoDictionary?["CFBundleShortVersionString"]  as? String
NSLog(myCFBundleShortVersionString! + "." + GIT_SHA_VERSION)

License

GitVersioningOnXCode is available under the MIT license.

Copyright © 2013 Ildar Sibagatov.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Pretty Xcode Git versioning for iOS & macOS applications


Languages

Language:Shell 100.0%