From ef3fba75a908e5f7866e2f09c58fabbdc1062ca5 Mon Sep 17 00:00:00 2001 From: Kirill Zaitsev Date: Mon, 12 Jan 2015 16:51:54 +0300 Subject: [PATCH] Version from file --- Makefile | 12 ++++++++---- VERSION | 1 + cli/main.go | 2 +- server/main.go | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 VERSION diff --git a/Makefile b/Makefile index e6efdd2a..2e9e12e0 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,6 @@ SHA := $(shell git rev-parse --short HEAD) +VERSION := $(shell cat VERSION) +ITTERATION := $(shell date +%s) all: build @@ -23,8 +25,8 @@ test_postgres: build: mkdir -p packaging/output mkdir -p packaging/root/usr/local/bin - go build -o packaging/root/usr/local/bin/drone -ldflags "-X main.revision $(SHA)" github.com/drone/drone/cli - go build -o packaging/root/usr/local/bin/droned -ldflags "-X main.revision $(SHA)" github.com/drone/drone/server + go build -o packaging/root/usr/local/bin/drone -ldflags "-X main.revision $(SHA) -X main.version $(VERSION)" github.com/drone/drone/cli + go build -o packaging/root/usr/local/bin/droned -ldflags "-X main.revision $(SHA) -X main.version $(VERSION)" github.com/drone/drone/server install: install -t /usr/local/bin packaging/root/usr/local/bin/drone @@ -52,9 +54,10 @@ embed: # creates a debian package for drone to install # `sudo dpkg -i drone.deb` deb: - fpm -s dir -t deb -n drone -v 0.3 -p packaging/output/drone.deb \ + fpm -s dir -t deb -n drone -v $(VERSION) -p packaging/output/drone.deb \ --deb-priority optional --category admin \ --force \ + --iteration $(ITTERATION) \ --deb-compression bzip2 \ --after-install packaging/scripts/postinst.deb \ --before-remove packaging/scripts/prerm.deb \ @@ -68,9 +71,10 @@ deb: packaging/root/=/ rpm: - fpm -s dir -t rpm -n drone -v 0.3 -p packaging/output/drone.rpm \ + fpm -s dir -t rpm -n drone -v $(VERSION) -p packaging/output/drone.rpm \ --rpm-compression bzip2 --rpm-os linux \ --force \ + --iteration $(ITTERATION) \ --after-install packaging/scripts/postinst.rpm \ --before-remove packaging/scripts/prerm.rpm \ --after-remove packaging/scripts/postrm.rpm \ diff --git a/VERSION b/VERSION new file mode 100644 index 00000000..0852d432 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.3.0-alpha \ No newline at end of file diff --git a/cli/main.go b/cli/main.go index d051834c..0a2e3b90 100644 --- a/cli/main.go +++ b/cli/main.go @@ -7,7 +7,7 @@ import ( var ( // commit sha for the current build. - version string = "0.3-dev" + version string revision string ) diff --git a/server/main.go b/server/main.go index 9fd47cd2..ae41dc7b 100644 --- a/server/main.go +++ b/server/main.go @@ -41,7 +41,7 @@ const ( var ( // commit sha for the current build, set by // the compile process. - version string = "0.3-dev" + version string revision string )