Skip to content

Commit 44f79c3

Browse files
committed
Update build process.
Docs are now pulled from the regular telepresence repository, and the pull is unidirectional. Needs some more work to automatically setup the link to latest and commit the result.
1 parent 593a1dc commit 44f79c3

File tree

2 files changed

+24
-42
lines changed

2 files changed

+24
-42
lines changed

DEVELOPING.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Commands of interest:
2020
yarn run gatsby develop # Serve a hot-reloading development-build at http://localhost:8000/
2121
yarn run gatsby repl # Run a Node.js REPL in the Gatsby environment
2222
yarn run eslint . # Run the linter
23-
make pull-docs # Update ./docs/ from ambassador-docs.git
23+
make pull-docs # Update ./docs/ from telepresenceio/telepresence.git
2424

2525
# Production or production-like
2626
yarn run gatsby build # Build a production-build, writing it to ./public/
@@ -179,11 +179,10 @@ So we should upgrade Gatsby and associated plugins, and then turn
179179

180180
The docs-build machinery in of `package.json`, `gatsby-config.js`,
181181
`gatsby-node.js`, `src/assets/` and `src/components/` seem obviously
182-
want be a separate reusable module, so that these things don't need to
183-
be manually kept in-sync between getambassador.io, telepresence.io,
184-
and emissaryingress.io. This seems to be mostly obvious an trival to
185-
do... except for I can't figure how to handle
186-
`src/templates/doc-page.js` to where it's sufficiently
182+
want to be a separate reusable module, so that these things don't need to
183+
be manually kept in-sync between telepresence.io, and telepresence.
184+
This seems to be mostly obvious an trival to do... except for I can't
185+
figure how to handle `src/templates/doc-page.js` to where it's sufficiently
187186
parametarized/pluggable, or a way to make it possible to plug in the
188187
site-specific one.
189188

Makefile

Lines changed: 19 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,24 @@
1-
define nl
2-
3-
4-
endef
5-
6-
subtree-preflight:
7-
@if ! grep -q -e 'has_been_added' $$(PATH=$$(git --exec-path):$$PATH which git-subtree 2>/dev/null) /dev/null; then \
8-
printf '$(RED)Please upgrade your git-subtree:$(END)\n'; \
9-
printf '$(BLD) sudo curl -fL https://raw.githubusercontent.com/LukeShu/git/lukeshu/next/2021-05-15/contrib/subtree/git-subtree.sh -o $$(git --exec-path)/git-subtree && sudo chmod 755 $$(git --exec-path)/git-subtree$(END)\n'; \
10-
false; \
11-
else \
12-
printf '$(GRN)git-subtree OK$(END)\n'; \
1+
# Ensure that the telepresence remote is up-to-date.
2+
telepresence-remote:
3+
@if [ "$$(git remote | grep -E '^telepresence$$')" = 'telepresence' ]; then\
4+
git remote update telepresence;\
5+
else\
6+
git remote add -f telepresence [email protected]:telepresenceio/telepresence.git;\
137
fi
14-
git gc
15-
.PHONY: subtree-preflight
8+
.PHONY: telepresence-remote
169

17-
PULL_PREFIX ?=
18-
PUSH_PREFIX ?= $(USER)/from-telepresence.io-$(shell date +%Y-%m-%d)/
10+
# MATCH_TAGS is the regexp matching the tags that we expect will have docs.
11+
MATCH_TAGS ?= ^v2\.[2-9][0-9]+\.[0-9]+(-(rc|test)\.[0-9]+)$$
1912

20-
dir2branch = $(patsubst docs/%,release/%,$(subst pre-release,v2,$1))
13+
# EXCLUDE_TAGS is used when we want to exclude some of the matching tags from the telepresence repository
14+
EXCLUDE_TAGS ?=
2115

22-
# Used when syncing from telepresenceio since that repo doesn't
23-
# have docs for v1.
24-
EXCLUDE_DIR ?= ""
25-
pull-docs: ## Update ./docs from https://github.com/telepresenceio/docs
26-
pull-docs: subtree-preflight
27-
$(foreach subdir,$(shell find docs -mindepth 1 -maxdepth 1 -type d -not -name $(EXCLUDE_DIR)|sort -V),\
28-
git subtree pull --squash --prefix=$(subdir) https://github.com/telepresenceio/docs $(PULL_PREFIX)$(call dir2branch,$(subdir))$(nl))
16+
# Update the docs at docs/v<major>.<minor> from the found tags.
17+
pull-docs:
18+
$(foreach release,$(shell git tag -l | grep -E '$(MATCH_TAGS)' | (test -n '$(EXCLUDE_TAGS)' && grep -vE '$(EXCLUDE_TAGS)' || cat) | sort -V),\
19+
dir=$$(expr '$(release)' : '\(v[0-9]\.[0-9][0-9]*\)');\
20+
echo $$dir;\
21+
rm -rf docs/$$dir;\
22+
git add docs;\
23+
git read-tree --prefix docs/$$dir -u $(release):docs)
2924
.PHONY: pull-docs
30-
31-
PUSH_BRANCH ?= $(USER)/from-telepresence.io-$(shell date +%Y-%m-%d)
32-
push-docs: ## Publish ./ambassador to https://github.com/telepresenceio/docs
33-
push-docs: subtree-preflight
34-
@PS4=; set -x; { \
35-
git remote add --no-tags remote-docs https://github.com/telepresenceio/docs && \
36-
git remote set-url --push remote-docs [email protected]:telepresenceio/docs && \
37-
:; } || true
38-
git fetch --prune remote-docs
39-
$(foreach subdir,$(shell find docs -mindepth 1 -maxdepth 1 -type d|sort -V),\
40-
git subtree push --rejoin --squash --prefix=$(subdir) remote-docs $(PUSH_PREFIX)$(call dir2branch,$(subdir))$(nl))
41-
.PHONY: push-docs

0 commit comments

Comments
 (0)