feat(version): generate version from git tags

This will generate the version based on git tags. So if it is built
directly on a tag it will use the tag name and if it is built off a
commit that isn't a tag it will look like:

    $ curl localhost:7001
    0-267-ga39cf1c
release-0.4
Brandon Philips 2013-08-06 15:34:17 -07:00
parent 0045b3b764
commit a7deba0f90
4 changed files with 10 additions and 2 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
src
etcd
release_version.go

1
build
View File

@ -21,4 +21,5 @@ for i in third_party/*; do
cp -R $i src/
done
./scripts/release-version > release_version.go
go build ${ETCD_PACKAGE}

8
scripts/release-version Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
VER=$(git describe --tags HEAD)
cat <<EOF
package main
var releaseVersion = "$VER"
EOF

View File

@ -1,5 +1,3 @@
package main
var version = "v1"
var releaseVersion = "etcd pre-0.1"