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

1. This patch fixes error:

    rm -rf gh-pages/
    make V=1 gh-pages
    make[1]: Leaving directory '/800GBPCIex4/share/searx'
    [ -d "gh-pages/.git" ] || git clone  gh-pages
    fatal: repository 'gh-pages' does not exist

2. The gh-page build has been moved to ./build/gh-pages this also affects
   'travis-gh-pages'

3. The gh-pages commit messages now includes a ref to the repository and commit

4. Since a gh-pages history has only the drawback that the reposetory grows
   fast, this patch also flattens the history:

    cd build/gh-pages/; git log --oneline
    bash: cd: build/gh-pages/: Datei oder Verzeichnis nicht gefunden
    026126be (HEAD -> gh-pages, origin/gh-pages) make gh-pages: from https://github.com/return42/searx.git@71d66979c2935312e0aed7fc7c3cf6199fbe88a2

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2021-01-29 11:41:48 +01:00
parent 71d66979c2
commit 40d2a116e1
2 changed files with 12 additions and 14 deletions

View File

@ -80,7 +80,7 @@ jobs:
with: with:
GITHUB_TOKEN: ${{ github.token }} GITHUB_TOKEN: ${{ github.token }}
BRANCH: gh-pages BRANCH: gh-pages
FOLDER: gh-pages FOLDER: build/gh-pages
CLEAN: true # Automatically remove deleted files from the deploy branch CLEAN: true # Automatically remove deleted files from the deploy branch
dockers: dockers:

View File

@ -10,7 +10,7 @@ SPHINX_CONF ?= conf.py
DOCS_FOLDER = ./docs DOCS_FOLDER = ./docs
DOCS_BUILD = ./$(LXC_ENV_FOLDER)build/docs DOCS_BUILD = ./$(LXC_ENV_FOLDER)build/docs
DOCS_DIST = ./$(LXC_ENV_FOLDER)dist/docs DOCS_DIST = ./$(LXC_ENV_FOLDER)dist/docs
GH_PAGES ?= gh-pages GH_PAGES ?= build/gh-pages
BOOKS_FOLDER = ./docs BOOKS_FOLDER = ./docs
BOOKS_DIST = ./$(LXC_ENV_FOLDER)dist/books BOOKS_DIST = ./$(LXC_ENV_FOLDER)dist/books
@ -172,24 +172,22 @@ PHONY += prepare-gh-pages
prepare-gh-pages: prepare-gh-pages:
cp -r $(DOCS_DIST)/* $(GH_PAGES)/ cp -r $(DOCS_DIST)/* $(GH_PAGES)/
touch $(GH_PAGES)/.nojekyll touch $(GH_PAGES)/.nojekyll
echo "<html><head><META http-equiv='refresh' content='0;URL=index.html'></head></html>" > $(GH_PAGES)/404.html echo "<html><head><META http-equiv='refresh' content='0;URL=index.html'></head></html>" > $(GH_PAGES)/404.html
PHONY += $(GH_PAGES) PHONY += gh-pages
$(GH_PAGES):: gh-pages: docs-clean docs
$(MAKE) docs - git worktree remove -f $(GH_PAGES) || exit 0
[ -d "gh-pages/.git" ] || git clone $(GIT_URL) gh-pages - git branch -D gh-pages || exit 0
-cd $(GH_PAGES); git checkout gh-pages >/dev/null git worktree add --no-checkout $(GH_PAGES) master
-cd $(GH_PAGES); git pull cd $(GH_PAGES); git checkout --orphan gh-pages && git rm -rfq .
-cd $(GH_PAGES); ls -A | grep -v '.git$$' | xargs rm -rf
$(MAKE) prepare-gh-pages $(MAKE) prepare-gh-pages
cd $(GH_PAGES);\ cd $(GH_PAGES);\
git add --all . ;\ git add --all . ;\
git commit -m "gh-pages: updated" ;\ git commit -q -m "make gh-pages: from $(shell git config --get remote.origin.url)@$(shell git rev-parse HEAD)" ;\
git push origin gh-pages git push -f origin gh-pages
PHONY += travis-gh-pages PHONY += travis-gh-pages
travis-gh-pages: travis-gh-pages: docs-clean docs
$(MAKE) docs
rm -Rf $(GH_PAGES) rm -Rf $(GH_PAGES)
mkdir -p $(GH_PAGES) mkdir -p $(GH_PAGES)
$(MAKE) prepare-gh-pages $(MAKE) prepare-gh-pages