aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2021-08-15 15:22:47 -0700
committerFranck Cuny <franck@fcuny.net>2021-08-15 15:22:47 -0700
commitb9e1ff75bef87e48e1fba73f2fcdc54ae03c5326 (patch)
treebb6fac68fb2d389a4ca577f56acf66f836491928
parentblog: working with go - initial content (diff)
downloadfcuny.net-b9e1ff75bef87e48e1fba73f2fcdc54ae03c5326.tar.gz
build: tag the repo after a deploy
If the deployment is successful, tag the repository with the version being deployed on fly.io. Don't deploy unless the repository is clean (this is done with the target `worktree-clean`).
-rw-r--r--Makefile9
1 files changed, 7 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 0276958..1275e1b 100644
--- a/Makefile
+++ b/Makefile
@@ -5,16 +5,21 @@ DOCKER_IMAGE_REF := $(shell git rev-parse HEAD)
DOCKERFILE := Dockerfile
PROJECT_DIR := $(realpath $(CURDIR))
-.PHONY: server deploy docker-build docker-run
+.PHONY: server deploy docker-build docker-run worktree-clean
server:
@echo "Running hugo server ..."
hugo server
-deploy:
+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)
+ git tag --message $(shell flyctl info -j |jq '.App | "\(.Name)/v\(.Version)"') $(shell flyctl info -j |jq '.App | "\(.Name)/v\(.Version)"')
docker-build:
@echo "Building Docker image ..."