|
1 |
| -PLAYBOOK := local-antora-playbook.yml |
2 |
| -ANTORAFLAGS := |
| 1 | +CURRENT_COMMIT := $(shell git rev-parse HEAD) |
3 | 2 |
|
4 |
| -build: |
| 3 | +build-dev: build-ui |
| 4 | + node_modules/.bin/antora generate local-antora-playbook.yml |
| 5 | + |
| 6 | +build-prod: build-ui |
| 7 | + node_modules/.bin/antora generate antora-playbook.yml --fetch |
| 8 | + |
| 9 | +build-ui: |
5 | 10 | node_modules/.bin/gulp --cwd ui bundle
|
6 |
| - node_modules/.bin/antora generate $(PLAYBOOK) $(ANTORAFLAGS) |
7 | 11 |
|
8 |
| -.PHONY: clean |
9 | 12 | clean:
|
10 | 13 | rm -r build
|
11 | 14 | # 'cache' is the configured cache dir in the playbook
|
12 | 15 | rm -r cache
|
13 | 16 |
|
14 |
| -.PHONY: build |
| 17 | +# The netlify repo is checked out without any blobs. This script |
| 18 | +# iterates through the release branches and checks them out one-by-one |
| 19 | +# to fetch all the files. |
| 20 | +# Then we can build directly from here, making it possible to build |
| 21 | +# with antora using the HEAD (enabling branch previews!) |
| 22 | +netlify-fetch: |
| 23 | + git submodule update --init --recursive |
| 24 | + # netlify messes with some files, restore everything to how it was: |
| 25 | + git reset --hard --recurse-submodule |
| 26 | + # fetch, because netlify does caching and we want to get the latest commits |
| 27 | + git fetch --all |
| 28 | + # checkout all release branches once, so we fetch the files |
| 29 | + for remote in $(shell git branch -r | grep release/); do \ |
| 30 | + git checkout --recurse-submodules "$${remote#origin/}" ;\ |
| 31 | + done |
| 32 | + # go back to the initial commit to start the build |
| 33 | + git -c advice.detachedHead=false checkout --recurse-submodules $(CURRENT_COMMIT) |
| 34 | + |
| 35 | +netlify-build: netlify-fetch build-prod |
| 36 | + |
| 37 | +.PHONY: build-dev build-prod build-ui clean netlify-build netlify-fetch |
0 commit comments