-
Notifications
You must be signed in to change notification settings - Fork 36
/
Makefile
29 lines (26 loc) · 1020 Bytes
/
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
GIT_BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
USER=$(shell whoami)
STAGING_BUCKET=docs-mongodb-org-stg
STAGING_URL="https://docs-mongodb-org-stg.s3.us-east-2.amazonaws.com"
-include .env.production
.PHONY: stage
# To stage a specific build, include the commit hash as environment variable when staging
# example: COMMIT_HASH=123456 make stage
# Here, generate path prefix according to environment variables
prefix:
ifdef COMMIT_HASH
ifdef PATCH_ID
PREFIX = $(COMMIT_HASH)/$(PATCH_ID)/$(GATSBY_PARSER_BRANCH)/$(GATSBY_SITE)
else
PREFIX = $(COMMIT_HASH)/$(GATSBY_PARSER_BRANCH)/$(GATSBY_SITE)
endif
else
PREFIX = $(GATSBY_PARSER_BRANCH)/$(GATSBY_SITE)
endif
stage: prefix
@if [ -z "${GATSBY_SNOOTY_DEV}" ]; then \
echo "To stage changes to the Snooty frontend, ensure that GATSBY_SNOOTY_DEV=true in your production environment."; exit 1; \
else \
mut-publish public ${STAGING_BUCKET} --prefix=${PREFIX} --stage ${ARGS}; \
echo "Hosted at ${STAGING_URL}/${PREFIX}/${USER}/${GIT_BRANCH}/index.html"; \
fi