Ver código fonte

docs: updated make file for docs to support specifying env and version

Torkel Ödegaard 8 anos atrás
pai
commit
24e3777894
3 arquivos alterados com 13 adições e 14 exclusões
  1. 11 13
      docs/Makefile
  2. 1 1
      docs/VERSION
  3. 1 0
      docs/sources/archive.md

+ 11 - 13
docs/Makefile

@@ -1,4 +1,4 @@
-.PHONY: all default docs docs-build docs-shell shell test
+.PHONY: all default docs docs-build docs-shell shell checkvars
 
 # to allow `make DOCSPORT=9000 docs`
 DOCSPORT := 3004
@@ -11,26 +11,24 @@ DOCS_MOUNT := -v $(SOURCES_HOST_DIR):/site/content
 
 DOCKER_RUN_DOCS := docker run --rm -it $(DOCS_MOUNT) -e NOCACHE -p 3004:3004 -p 3005:3005
 
-VERSION = "root"
-
-$(info publishing $(VERSION))
+VERSION := $(shell head -n 1 VERSION)
 
 default: docs
 
+checkvars:
+ifndef ENV
+	$(error ENV is undefined set via ENV=staging or ENV=prod as argument to make)
+endif
+
 docs: docs-build
 	$(DOCKER_RUN_DOCS) $(DOCS_MOUNT) -e DOCKERHOST "$(DOCKER_DOCS_IMAGE)" /bin/bash -c "grunt --env=dev-docs && grunt connect --port=3004"
 
-test: docs-build
-	$(DOCKER_RUN_DOCS) $(DOCS_MOUNT) -e DOCKERHOST "$(DOCKER_DOCS_IMAGE)" /bin/bash -c "ls -la /site/content"
-
-docs-watch: docs-build
+watch: docs-build
 	$(DOCKER_RUN_DOCS) $(DOCS_MOUNT) -e DOCKERHOST "$(DOCKER_DOCS_IMAGE)" /bin/bash -c "grunt --env=dev-docs && grunt connect --port=3004 & grunt watch --port=3004 --env=dev-docs"
 
-publish: docs-build
-	$(DOCKER_RUN_DOCS) $(DOCS_MOUNT) -e DOCKERHOST "$(DOCKER_DOCS_IMAGE)" /bin/bash -c "./publish.sh staging-docs ${VERSION}"
-
-publish-prod: docs-build
-	$(DOCKER_RUN_DOCS) $(DOCS_MOUNT) -e DOCKERHOST "$(DOCKER_DOCS_IMAGE)" /bin/bash -c "./publish.sh prod-docs ${VERSION}"
+publish: checkvars docs-build
+	$(info Publishing ENV=${ENV} and VERSION=${VERSION})
+	$(DOCKER_RUN_DOCS) $(DOCS_MOUNT) -e DOCKERHOST "$(DOCKER_DOCS_IMAGE)" /bin/bash -c "./publish.sh ${ENV}-docs ${VERSION}"
 
 docs-build:
 	docker build -t "$(DOCKER_DOCS_IMAGE)" --no-cache .

+ 1 - 1
docs/VERSION

@@ -1 +1 @@
-3.1.0
+v4.2

+ 1 - 0
docs/sources/archive.md

@@ -13,5 +13,6 @@ Here you can find links to older versions of the documentation that might be bet
 of Grafana.
 
 - [Latest](http://docs.grafana.org)
+- [Version 4.2](http://docs.grafana.org/v4.2)
 - [Version 3.1](http://docs.grafana.org/v3.1)
 - [Version 3.0](http://docs.grafana.org/v3.0)