Просмотр исходного кода

Set a default version using git describe

If a VERSION is not specified, this will generate a version string that
represents the state of the repo.  For example `0.1.21-12-gffaf52e-dirty`
representing 12 commits away from 0.1.21 tag, on commit gffaf52e
and the tree is dirty.
Daniel Hiltgen 1 год назад
Родитель
Сommit
3005ec74b3
3 измененных файлов с 3 добавлено и 3 удалено
  1. 1 1
      scripts/build_darwin.sh
  2. 1 1
      scripts/build_docker.sh
  3. 1 1
      scripts/build_linux.sh

+ 1 - 1
scripts/build_darwin.sh

@@ -2,7 +2,7 @@
 
 
 set -e
 set -e
 
 
-export VERSION=${VERSION:-0.0.0}
+export VERSION=${VERSION:-$(git describe --tags --first-parent --abbrev=7 --long --dirty --always | sed -e "s/^v//g")}
 export GOFLAGS="'-ldflags=-w -s \"-X=github.com/jmorganca/ollama/version.Version=$VERSION\" \"-X=github.com/jmorganca/ollama/server.mode=release\"'"
 export GOFLAGS="'-ldflags=-w -s \"-X=github.com/jmorganca/ollama/version.Version=$VERSION\" \"-X=github.com/jmorganca/ollama/server.mode=release\"'"
 
 
 mkdir -p dist
 mkdir -p dist

+ 1 - 1
scripts/build_docker.sh

@@ -2,7 +2,7 @@
 
 
 set -eu
 set -eu
 
 
-export VERSION=${VERSION:-0.0.0}
+export VERSION=${VERSION:-$(git describe --tags --first-parent --abbrev=7 --long --dirty --always | sed -e "s/^v//g")}
 export GOFLAGS="'-ldflags=-w -s \"-X=github.com/jmorganca/ollama/version.Version=$VERSION\" \"-X=github.com/jmorganca/ollama/server.mode=release\"'"
 export GOFLAGS="'-ldflags=-w -s \"-X=github.com/jmorganca/ollama/version.Version=$VERSION\" \"-X=github.com/jmorganca/ollama/server.mode=release\"'"
 
 
 docker build \
 docker build \

+ 1 - 1
scripts/build_linux.sh

@@ -2,7 +2,7 @@
 
 
 set -eu
 set -eu
 
 
-export VERSION=${VERSION:-0.0.0}
+export VERSION=${VERSION:-$(git describe --tags --first-parent --abbrev=7 --long --dirty --always | sed -e "s/^v//g")}
 export GOFLAGS="'-ldflags=-w -s \"-X=github.com/jmorganca/ollama/version.Version=$VERSION\" \"-X=github.com/jmorganca/ollama/server.mode=release\"'"
 export GOFLAGS="'-ldflags=-w -s \"-X=github.com/jmorganca/ollama/version.Version=$VERSION\" \"-X=github.com/jmorganca/ollama/server.mode=release\"'"
 
 
 BUILD_ARCH=${BUILD_ARCH:-"amd64 arm64"}
 BUILD_ARCH=${BUILD_ARCH:-"amd64 arm64"}