-
Notifications
You must be signed in to change notification settings - Fork 139
Expand file tree
/
Copy pathsite.mk.example
More file actions
68 lines (63 loc) · 3.07 KB
/
Copy pathsite.mk.example
File metadata and controls
68 lines (63 loc) · 3.07 KB
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
# site.mk — Site-specific Makefile overrides
#
# Copy this file to site.mk and customize for your environment.
# site.mk is gitignored and will not be committed.
#
# All variables and targets from the main Makefile are available.
# Targets defined here extend (not replace) the main Makefile.
# Do not put secrets in this file — the deploy targets deliberately
# take credentials from tool state (cf login, git remotes), not variables.
#
# Three extension patterns, each shown below:
# 1. Parameter override — set a variable the Makefile consumes.
# 2. Recipe override — redefine a recipe variable (define NAME ... endef);
# the already-registered target picks up the new body. Do NOT call
# register again — that would duplicate the rule and make will warn.
# 3. New destination — add a modifier word for `deploy website`.
# ── Site Help ─────────────────────────────────────────────────
# This target is called by 'make help' when site.mk exists.
.PHONY: $(_HIDE)site-help
$(_HIDE)site-help:
@echo ""
@echo "Site-specific:"
@echo " make deploy cf Push existing app CF zip to current CF target"
@echo " make build release deploy cf Build, package, and push app to current CF target"
# ── 1. Parameter override: fork remote for Pages previews ────
# `make deploy website pages` pushes to the `origin` remote by default,
# which is correct when your clone's origin is your fork. If your fork
# is a differently named remote, set it here:
#
# PAGES_REMOTE = my-fork
# ── 2. Recipe override: enable app deploys to CF ─────────────
# The committed Makefile only deploys the documentation website; app
# deployment (the zip from `make release cf`) is site-specific and errors
# by default. Redefine deploy.cf.app to enable it:
define deploy.cf.app
@echo "Deploying app to CF..."
@cf target | grep -E "org:|space:" || \
{ echo "ERROR: No CF target set. Run 'cf target -o ORG -s SPACE' first." >&2; exit 1; }
@ZIP=$$(ls -t $($(_HIDE)DIST_DIR)/stratos-cf-*.zip 2>/dev/null | head -1); \
if [ -z "$$ZIP" ]; then \
echo "ERROR: No CF zip found. Run 'make build release cf' first." >&2; exit 1; \
fi; \
echo "Deploying $$ZIP..."; \
cf push -f $($(_HIDE)DIST_DIR)/cf-package/manifest.yml -p "$$ZIP"
endef
# ── 3. New destination for `deploy website` ──────────────────
# Operators publishing the site to their own infrastructure add a
# destination word: flag + no-op target + recipe + register. Uncomment
# and adapt. Adding the word to WEBSITE_DEPLOY_DESTS keeps the
# `make deploy website` usage message accurate.
#
# WEBSITE_DEPLOY_DESTS += mysite
# $(_HIDE)FLAG_mysite := $(filter mysite,$(MAKECMDGOALS))
# .PHONY: mysite
# mysite:
# @:
#
# define deploy.mysite
# @[ -d website/build ] || \
# { echo "ERROR: website/build not found. Run 'make build website' first." >&2; exit 1; }
# rsync -a --delete website/build/ deploy@docs.example.internal:/srv/docs/
# endef
# $(call register, deploy, mysite)