on master help sign in
Merge pull request #2514 from return42/fix-gh-pages

[fix] Makefile target gh-pages & flatten history of branch gh.pages

commit99244440e42b970252b63fb1194ee1503afda704 authorAlexandre Flament <alex@al-f.net> dateMon 1 Feb 2021, 17:07 (6 years ago) parent0a8799b40d2a11
2 files changed+13−15
.github/workflows/integration.yml+1−1 utils/makefile.sphinx+12−14
.github/workflows/integration.yml+1−1
@@ -80,7 +80,7 @@ jobs:
8080 with:
8181 GITHUB_TOKEN: ${{ github.token }}
8282 BRANCH: gh-pages
83− FOLDER: gh-pages
83+ FOLDER: build/gh-pages
8484 CLEAN: true # Automatically remove deleted files from the deploy branch
8585
8686 dockers:
utils/makefile.sphinx+12−14
@@ -10,7 +10,7 @@ SPHINX_CONF ?= conf.py
1010DOCS_FOLDER = ./docs
1111DOCS_BUILD = ./$(LXC_ENV_FOLDER)build/docs
1212DOCS_DIST = ./$(LXC_ENV_FOLDER)dist/docs
13−GH_PAGES ?= gh-pages
13+GH_PAGES ?= build/gh-pages
1414
1515BOOKS_FOLDER = ./docs
1616BOOKS_DIST = ./$(LXC_ENV_FOLDER)dist/books
@@ -172,24 +172,22 @@ PHONY += prepare-gh-pages
172172prepare-gh-pages:
173173 cp -r $(DOCS_DIST)/* $(GH_PAGES)/
174174 touch $(GH_PAGES)/.nojekyll
175− echo "<html><head><META http-equiv='refresh' content='0;URL=index.html'></head></html>" > $(GH_PAGES)/404.html
176−
177−PHONY += $(GH_PAGES)
178−$(GH_PAGES)::
179− $(MAKE) docs
180− [ -d "gh-pages/.git" ] || git clone $(GIT_URL) gh-pages
181− -cd $(GH_PAGES); git checkout gh-pages >/dev/null
182− -cd $(GH_PAGES); git pull
183− -cd $(GH_PAGES); ls -A | grep -v '.git$$' | xargs rm -rf
175+ echo "<html><head><META http-equiv='refresh' content='0;URL=index.html'></head></html>" > $(GH_PAGES)/404.html
176+
177+PHONY += gh-pages
178+gh-pages: docs-clean docs
179+ - git worktree remove -f $(GH_PAGES) || exit 0
180+ - git branch -D gh-pages || exit 0
181+ git worktree add --no-checkout $(GH_PAGES) master
182+ cd $(GH_PAGES); git checkout --orphan gh-pages && git rm -rfq .
184183 $(MAKE) prepare-gh-pages
185184 cd $(GH_PAGES);\
186185 git add --all . ;\
187− git commit -m "gh-pages: updated" ;\
188− git push origin gh-pages
186+ git commit -q -m "make gh-pages: from $(shell git config --get remote.origin.url)@$(shell git rev-parse HEAD)" ;\
187+ git push -f origin gh-pages
189188
190189PHONY += travis-gh-pages
191−travis-gh-pages:
192− $(MAKE) docs
190+travis-gh-pages: docs-clean docs
193191 rm -Rf $(GH_PAGES)
194192 mkdir -p $(GH_PAGES)
195193 $(MAKE) prepare-gh-pages