include hash in version

This commit is contained in:
Zack Scholl 2019-05-03 20:15:29 -07:00
parent a6512975ff
commit cb69e49283
4 changed files with 10 additions and 5 deletions

View File

@ -4,7 +4,7 @@
src="https://user-images.githubusercontent.com/6550035/46709024-9b23ad00-cbf6-11e8-9fb2-ca8b20b7dbec.jpg"
width="408px" border="0" alt="croc">
<br>
<a href="https://github.com/schollz/croc/releases/latest"><img src="https://img.shields.io/badge/version-v6.0.0-brightgreen.svg?style=flat-square" alt="Version"></a>
<a href="https://github.com/schollz/croc/releases/latest"><img src="https://img.shields.io/badge/version-v4.1.6-brightgreen.svg?style=flat-square" alt="Version"></a>
<a href="https://travis-ci.org/schollz/croc"><img
src="https://img.shields.io/travis/schollz/croc.svg?style=flat-square" alt="Build
Status"></a>

View File

@ -27,7 +27,7 @@ func Run() (err error) {
app := cli.NewApp()
app.Name = "croc"
if Version == "" {
Version = "v6.0.0"
Version = "v4.1.6-134-ga651297-a651297"
}
app.Version = Version
app.Compiled = time.Now()

View File

@ -33,7 +33,7 @@ install_croc()
croc_os="unsupported"
croc_arch="unknown"
croc_arm=""
croc_version="6.0.0"
croc_version="4.1.6"
# Termux on Android has $PREFIX set which already ends with /usr

View File

@ -19,9 +19,14 @@ func run() (err error) {
if err != nil {
return
}
versionNew := strings.TrimSpace(string(version))
versionNew := strings.TrimSpace(string(version))
versionHash, err := exec.Command("git", "rev-parse","--short","HEAD").Output()
if err != nil {
return
}
versionHashNew := strings.TrimSpace(string(versionHash))
err = replaceInFile("src/cli/cli.go", `Version = "`, `"`, versionNew)
err = replaceInFile("src/cli/cli.go", `Version = "`, `"`, versionNew + "-"+ versionHashNew)
if err == nil {
fmt.Printf("updated cli.go to version %s\n", versionNew)
}