Skip to content

Converts a sha number to a build number and back again without needing storage in a repo.

License

Notifications You must be signed in to change notification settings

Bolloxim/git-sha-to-build-number

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Git Build and Deploy versioning helpers

Git Sha# to Build Number

shaToBuild.sh <sha#>

An example to get the current head as a build number

shaToBuild.sh `git rev-parse HEAD`

This is useful for create a process.env.BUILD_VERSION during a build by calling the script to get the currrent build value. Alternatively if the build has the sha# already it can just be used directly.

Build Number to Git Sha#

buildToSha.sh <build number>

This is where the real magic happens, it takes the build number and calculates where the actual sha# is relative to current head. It does this by using the difference and skips accordingly

The return value is a git sha# which can then be used to look up the version that is referenced by the build. additionally, the value returned is also already on the clipboard if on MAC (I should probably do win64 and linux versions)

Author: Andi Smithers, The Walt Disney Company Created: Dec 2012 open sourced for free use under the MIT license, but please keep the author information within the files

About

Converts a sha number to a build number and back again without needing storage in a repo.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages