about summary refs log tree commit diff
path: root/tools/govanity
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2021-09-09 18:13:05 -0700
committerFranck Cuny <franck@fcuny.net>2021-09-09 18:14:20 -0700
commit3161b0a05d07dfaada45dffd83b37672231edb9f (patch)
tree9ced83ad5269aac15979a8cdcff97eba867ddc1c /tools/govanity
parentbuild: create user before setting workdir (diff)
downloadworld-3161b0a05d07dfaada45dffd83b37672231edb9f.tar.gz
build: tag correctly the release
The version was evaluated before the deploy was done, we need to get
that information after running `flyctl deploy`.

Annotate the tag since we're doing a release.

Remove the argument `IMAGE_REF` since it's being ignored.
Diffstat (limited to 'tools/govanity')
-rw-r--r--tools/govanity/Makefile12
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/govanity/Makefile b/tools/govanity/Makefile
index 48eb9b4..9632386 100644
--- a/tools/govanity/Makefile
+++ b/tools/govanity/Makefile
@@ -5,21 +5,25 @@ DOCKER_IMAGE_REF := $(shell git rev-parse HEAD)
 DOCKERFILE := Dockerfile
 PROJECT_DIR := $(realpath $(CURDIR))
 
-.PHONY: deploy docker-build docker-run
+.PHONY: deploy docker-build docker-run worktree-clean server
 
 server:
 	@echo "Running server ..."
 	go run .
 
-deploy: docker-build
+worktree-clean:
+	git diff --exit-code
+	git diff --staged --exit-code
+
+deploy: worktree-clean docker-build
 	@echo "Deploying to fly ..."
-	flyctl deploy --build-arg IMAGE_REF=$(DOCKER_IMAGE_REF)
+	flyctl deploy
+	git tag -a --message $$(flyctl info -j |jq -r '.App | "\(.Name)/v\(.Version)"') $$(flyctl info -j |jq -r '.App | "\(.Name)/v\(.Version)"')
 
 docker-build:
 	@echo "Building Docker image ..."
 	$(DOCKER) build $(DOCKER_BUILD_ARGS) \
 		--tag "${DOCKER_IMAGE}:${DOCKER_IMAGE_REF}" \
-	  --build-arg IMAGE_REF=$(DOCKER_IMAGE_REF) \
 		--file "$(DOCKERFILE)" \
 		"$(PROJECT_DIR)"