-
Notifications
You must be signed in to change notification settings - Fork 88
/
Makefile
68 lines (51 loc) · 2.33 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
GIT_BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
USER=$(shell whoami)
STAGING_URL="https://docs-mongodborg-staging.corp.mongodb.com"
PRODUCTION_URL="https://www.mongodb.com/docs/realm"
STAGING_BUCKET=docs-mongodb-org-staging
PRODUCTION_BUCKET=docs-cloud-realm-prod
# "PROJECT" currently exists to support having multiple projects
# within one bucket.
PROJECT=realm
.PHONY: help lint html stage deploy deploy-search-index
help: ## Show this help message
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
@echo
@echo 'Variables'
@printf " \033[36m%-18s\033[0m %s\n" 'ARGS' 'Arguments to pass to mut-publish'
html: ## Builds this branch's HTML under build/<branch>/html
giza make html
publish: ## Builds this branch's publishable HTML and other artifacts under build/public
if [ ${GIT_BRANCH} = master ]; then rm -rf build/master build/public; fi
giza make publish
if [ ${GIT_BRANCH} = master ]; then mut-redirects config/redirects -o build/public/.htaccess; fi
lint: ## Checks URLs in the built corpus underneath build/<branch>/html
mut-lint --linters=links ./build/master/source/ ${ARGS}
stage: ## Host online for review
mut-publish build/${GIT_BRANCH}/html ${STAGING_BUCKET} --prefix=${PROJECT} --stage ${ARGS}
@echo "Hosted at ${STAGING_URL}/${PROJECT}/${USER}/${GIT_BRANCH}/index.html"
deploy: build/public ## Deploy to the production bucket
mut-publish build/public ${PRODUCTION_BUCKET} --prefix=${PROJECT} --deploy --redirect-prefix='ecosystem' --all-subdirectories ${ARGS}
@echo "Hosted at ${PRODUCTION_URL}/index.html"
$(MAKE) deploy-search-index
deploy-search-index: ## Update the search index for this branch
@echo "Building search index"
mut-index upload build/public -o ${PROJECT}-${GIT_BRANCH}.json -u ${PRODUCTION_URL} -s
#!make
MAKEFLAGS += --silent
# This allows us to accept extra arguments (by doing nothing when we get a job that doesn't match,
# rather than throwing an error).
%:
@:
# $(MAKECMDGOALS) is the list of "targets" spelled out on the command line
stagel:
git clone --quiet https://github.com/mongodb/snooty-scripts.git build_scripts
@ cd build_scripts && npm install
@ source ~/.config/.snootyenv && node build_scripts/app.js $(filter-out $@,$(MAKECMDGOALS))
@ rm -rf build_scripts
commit:
@:
local:
@:
clean:
rm -rf build