From 1d1ed69308bc734fc9986ae7a48c37cc476c9e2e Mon Sep 17 00:00:00 2001 From: Toshaan Bharvani Date: Thu, 14 Jul 2022 15:36:54 +0200 Subject: [PATCH] add staging build to makefile Signed-off-by: Toshaan Bharvani --- Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Makefile b/Makefile index 320810c..2c35cf2 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,8 @@ #!Makefile HUGO=hugo-extended +BUILDNAME:=$(shell git rev-parse --abbrev-ref HEAD) +BASEURL:=$(shell basename `pwd` | sed 's/_/./g') default all: build @@ -11,6 +13,10 @@ build: @find public/ -name '*.css' ! -name '*.gz' -type f -exec sh -c "gzip -c -9 < {} > {}.gz" \; @find public/ -name '*.js' ! -name '*.gz' -type f -exec sh -c "gzip -c -9 < {} > {}.gz" \; +.PHONY: build-staging +build-staging: + $(HUGO) --environment=production --minify --templateMetrics --baseURL https://$(BASEURL)/$(BUILDNAME)/ --destination builds/$(BUILDNAME) + .PHONY: test test: clean $(HUGO) --environment=development --minify @@ -34,4 +40,6 @@ servedraft: .PHONY: clean clean: @rm -rf public/ + @rm -rf builds/ @rm -rf resources/ +