|
1 |
| -%: |
2 |
| - giza make $@ |
3 |
| -help: |
4 |
| - @echo "Use 'make <target>', where <target> is a Sphinx target (e.g. 'html', 'latex')" |
5 |
| - @echo "See 'http://docs.mongodb.org/manual/meta' for more information." |
| 1 | +GIT_BRANCH=$(shell git rev-parse --abbrev-ref HEAD) |
| 2 | +PRODUCTION_URL="https://docs.mongodb.com" |
| 3 | +PRODUCTION_BUCKET=docs-mongodb-org-prod |
6 | 4 |
|
| 5 | +.PHONY: help html deploy deploy-search-index |
| 6 | + |
| 7 | +help: ## Show this help message |
| 8 | + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' |
| 9 | + @echo |
| 10 | + @echo 'Variables' |
| 11 | + @printf " \033[36m%-18s\033[0m %s\n" 'ARGS' 'Arguments to pass to mut-publish' |
| 12 | + |
| 13 | +html: ## Builds this branch's HTML under build/<branch>/html |
| 14 | + giza make html |
| 15 | + |
| 16 | +publish: ## Builds this branch's publishable HTML and other artifacts under build/public |
| 17 | + giza make publish |
| 18 | + |
| 19 | +# The recursive behavior would CHANGE if --all-subdirectories were |
| 20 | +# given: ALL contents of build/public/<branch> would be upload |
| 21 | +deploy: build/public ## Deploy to the production bucket |
| 22 | + @echo "Doing a dry-run" |
| 23 | + mut-publish build/public ${PRODUCTION_BUCKET} --prefix=${PROJECT} --deploy --redirect-prefix='v[0-9]\.[0-9]' --redirect-prefix='manual' --redirect-prefix='master' --verbose --dry-run ${ARGS} |
| 24 | + |
| 25 | + @echo 'Press any key to perform the previous' && read result |
| 26 | + mut-publish build/public ${PRODUCTION_BUCKET} --prefix=${PROJECT} --deploy --redirect-prefix='v[0-9]\.[0-9]' --redirect-prefix='manual' --redirect-prefix='master' ${ARGS} |
| 27 | + |
| 28 | + @echo "Hosted at ${PRODUCTION_URL}/index.html" |
| 29 | + |
| 30 | + $(MAKE) deploy-search-index |
| 31 | + |
| 32 | +deploy-search-index: ## Update the search index for this branch |
| 33 | + @echo "Building search index" |
| 34 | + mut-index upload build/public/${GIT_BRANCH} -o manual-${GIT_BRANCH}.json -u ${PRODUCTION_URL}/${GIT_BRANCH} -s --exclude build/public/${GIT_BRANCH}/meta |
0 commit comments