@@ -4,6 +4,10 @@ GITHUB_TOKEN?=
4
4
PACK_BIN? =$(shell which pack)
5
5
SERVE_PORT =1313
6
6
BASE_URL? =
7
+ HUGO_BIN =./tools/bin/hugo
8
+
9
+ # retreive latest hugo version
10
+ _latestver: =$(shell curl --silent "https://api.github.com/repos/gohugoio/hugo/tags" | jq -r '.[0].name' | tr -d v)
7
11
8
12
ifndef BASE_URL
9
13
ifdef GITPOD_WORKSPACE_URL
@@ -28,17 +32,24 @@ clean:
28
32
29
33
.PHONY : install-hugo
30
34
install-hugo :
35
+
31
36
@echo "> Installing hugo..."
32
37
@echo "This may take a while depending on your connection."
38
+
33
39
ifeq ($(OS ) ,Windows_NT)
34
- @echo $(shell uname -s)
35
- cd tools; mkdir bin; cd bin; curl -L -O $(shell curl https://api.github.com/repos/gohugoio/hugo/releases/latest | jq -r '.assets[30].browser_download_url')
36
-
40
+ @echo $(shell uname -s) ;
41
+ cd tools; mkdir bin; cd bin; curl -s -L -O $(shell curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | jq -r '.assets[30].browser_download_url')
37
42
else
38
- @echo $(shell uname -s)
39
- cd tools; mkdir bin; cd bin; curl -L -O $(shell curl https://api.github.com/repos/gohugoio/hugo/releases/latest | jq -r '.assets[26].browser_download_url')
43
+ ifeq ($(shell uname -s),Darwin)
44
+ @echo $(shell uname -s)
45
+ cd tools; mkdir bin; cd bin; curl -s -L -O $(shell curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | jq -r '.assets[28].browser_download_url'); tar xvfz hugo_extended_${_latestver}_macOS-64bit.tar.gz
46
+ else
47
+ @echo $(shell uname -s)
48
+ cd tools; mkdir bin; cd bin; curl -s -L -O $(shell curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | jq -r '.assets[27].browser_download_url'); tar xvfz hugo_extended_${_latestver}_Linux-64bit.tar.gz
49
+ endif
40
50
endif
41
51
52
+
42
53
43
54
44
55
.PHONY : upgrade-pack
@@ -80,16 +91,16 @@ serve: export PACK_VERSION:=$(PACK_VERSION)
80
91
serve : install-hugo pack-version pack-docs-update
81
92
@echo " > Serving..."
82
93
ifeq ($(BASE_URL ) ,)
83
- hugo server --disableFastRender --port=$(SERVE_PORT)
94
+ $(HUGO_BIN) server --disableFastRender --port=$(SERVE_PORT)
84
95
else
85
- hugo server --disableFastRender --port=$(SERVE_PORT) --baseURL=$(BASE_URL) --appendPort=false
96
+ $(HUGO_BIN) server --disableFastRender --port=$(SERVE_PORT) --baseURL=$(BASE_URL) --appendPort=false
86
97
endif
87
98
88
99
.PHONY : build
89
100
build : export PACK_VERSION:=$(PACK_VERSION )
90
101
build : install-hugo pack-version pack-docs-update
91
102
@echo " > Building..."
92
- hugo
103
+ $( HUGO_BIN )
93
104
94
105
.PHONY : test
95
106
test : install-pack-cli install-ugo
0 commit comments