Skip to content

Build from CI cloned repo (and fix netlify previews) #392

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 29 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,37 @@
PLAYBOOK := local-antora-playbook.yml
ANTORAFLAGS :=
CURRENT_COMMIT := $(shell git rev-parse HEAD)

build:
build-dev: build-ui
node_modules/.bin/antora generate local-antora-playbook.yml

build-prod: build-ui
node_modules/.bin/antora generate antora-playbook.yml --fetch

build-ui:
node_modules/.bin/gulp --cwd ui bundle
node_modules/.bin/antora generate $(PLAYBOOK) $(ANTORAFLAGS)

.PHONY: clean
clean:
rm -r build
# 'cache' is the configured cache dir in the playbook
rm -r cache

.PHONY: build
# The netlify repo is checked out without any blobs. This script
# iterates through the release branches and checks them out one-by-one
# to fetch all the files.
# Then we can build directly from here, making it possible to build
# with antora using the HEAD (enabling branch previews!)
netlify-fetch:
git submodule update --init --recursive
# netlify messes with some files, restore everything to how it was:
git reset --hard --recurse-submodule
# fetch, because netlify does caching and we want to get the latest commits
git fetch --all
# checkout all release branches once, so we fetch the files
for remote in $(shell git branch -r | grep release/); do \
git checkout --recurse-submodules "$${remote#origin/}" ;\
done
# go back to the initial commit to start the build
git -c advice.detachedHead=false checkout --recurse-submodules $(CURRENT_COMMIT)

netlify-build: netlify-fetch build-prod

.PHONY: build-dev build-prod build-ui clean netlify-build netlify-fetch
2 changes: 1 addition & 1 deletion antora-playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ urls:

content:
sources:
- url: https://github.com/stackabletech/documentation.git
- url: .
branches:
- HEAD
- release/23.4
Expand Down
4 changes: 4 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[build]
command = "make netlify-build"
publish = "build/site"

[[redirects]]
from = "/airflow/nightly/*"
to = "/home/nightly/airflow/:splat"
Expand Down