This repository has been archived by the owner on Apr 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
/
Makefile
78 lines (64 loc) · 2.24 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
69
70
71
72
73
74
75
76
77
78
CURRENT_UID = $(shell id -u):$(shell id -g)
DIST_DIR ?= $(CURDIR)/dist
REPOSITORY_NAME ?= slides
REPOSITORY_OWNER ?= containous
REPOSITORY_BASE_URL ?= https://github.com/$(REPOSITORY_OWNER)/$(REPOSITORY_NAME)
REPOSITORY_URL = $(REPOSITORY_BASE_URL)
PRESENTATION_URL = https://$(REPOSITORY_OWNER).github.io/$(REPOSITORY_NAME)
ifdef TRAVIS_TAG
REPOSITORY_URL = $(REPOSITORY_BASE_URL)/tree/$(TRAVIS_TAG)
PRESENTATION_URL = https://$(REPOSITORY_OWNER).github.io/$(REPOSITORY_NAME)/$(TRAVIS_TAG)
else
ifdef TRAVIS_BRANCH
ifneq ($(TRAVIS_BRANCH), master)
REPOSITORY_URL = $(REPOSITORY_BASE_URL)/tree/$(TRAVIS_BRANCH)
PRESENTATION_URL = https://$(REPOSITORY_OWNER).github.io/$(REPOSITORY_NAME)/$(TRAVIS_BRANCH)
endif
else
CURRENT_BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
REPOSITORY_URL = $(REPOSITORY_BASE_URL)/tree/$(CURRENT_BRANCH)
PRESENTATION_URL = https://$(REPOSITORY_OWNER).github.io/$(REPOSITORY_NAME)/$(CURRENT_BRANCH)
endif
endif
export PRESENTATION_URL CURRENT_UID REPOSITORY_URL REPOSITORY_BASE_URL
all: clean build verify
# Generate documents inside a container, all *.adoc in parallel
build: clean $(DIST_DIR)
@docker-compose up \
--build \
--force-recreate \
--exit-code-from build \
build
$(DIST_DIR):
mkdir -p $(DIST_DIR)
verify: $(DIST_DIR)/index.html
@docker run --rm \
-v $(DIST_DIR):/dist \
--user $(CURRENT_UID) \
18fgsa/html-proofer \
--check-html \
--http-status-ignore "999" \
--url-ignore "/localhost:/,/127.0.0.1:/,/$(PRESENTATION_URL)/,/bit.ly/,/demo.containous.cloud/,/lab-XX.ddu-workshops-Y.com/,/bastion.ddu-workshops-1.com/" \
/dist/index.html
serve: clean $(DIST_DIR)
@docker-compose up --build --force-recreate serve
shell: $(DIST_DIR)
@docker-compose up --build --force-recreate -d wait
@docker-compose exec --user root wait sh
$(DIST_DIR)/index.html: build
pdf: $(DIST_DIR)/index.html
@docker run --rm -t \
-v $(DIST_DIR):/slides \
--user $(CURRENT_UID) \
astefanutti/decktape:2.9 \
/slides/index.html \
/slides/slides.pdf \
--size='2048x1536'
deploy: pdf
@bash $(CURDIR)/scripts/travis-gh-deploy.sh
clean:
@docker-compose down -v --remove-orphans
@rm -rf $(DIST_DIR)
qrcode: $(DIST_DIR)
@docker-compose up --build --force-recreate qrcode
.PHONY: all build verify serve deploy qrcode pdf