[mod] .travis.yml: build documentation automatically on the master branch

This commit is contained in:
Alexandre Flament 2020-10-27 13:21:48 +01:00
parent 10ddd421f2
commit 54afe37e18
2 changed files with 34 additions and 3 deletions

View File

@ -23,6 +23,8 @@ after_success:
stages: stages:
- test - test
- name: documentation
if: env(GITHUB_TOKEN) IS present
- name: docker - name: docker
if: branch = master AND type != pull_request AND env(DOCKER_USERNAME) IS present if: branch = master AND type != pull_request AND env(DOCKER_USERNAME) IS present
@ -32,6 +34,26 @@ jobs:
- python: "3.6" - python: "3.6"
- python: "3.7" - python: "3.7"
- python: "3.8" - python: "3.8"
- stage: documentation
python: "3.8"
addons: []
before_install:
- sudo ./utils/searx.sh install buildhost
install: true
script:
- SEARX_DEBUG=1 make travis-gh-pages
after_success: true
deploy:
provider: pages
edge: false
token: $GITHUB_TOKEN # Set in the settings page of your repository, as a secure variable
strategy: git
skip_cleanup: true
keep_history: true
local_dir: gh-pages
target_branch: gh-pages
on:
branch: master
- stage: docker - stage: docker
python: "3.8" python: "3.8"
git: git:

View File

@ -168,6 +168,11 @@ $(BOOKS_CLEAN):
$(DOCS_BUILD)/latex/$(patsubst books/%.clean,%,$@) $(DOCS_BUILD)/latex/$(patsubst books/%.clean,%,$@)
# github pages # github pages
PHONY += prepare-gh-pages
prepare-gh-pages:
cp -r $(DOCS_DIST)/* $(GH_PAGES)/
touch $(GH_PAGES)/.nojekyll
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)::
@ -176,14 +181,18 @@ $(GH_PAGES)::
-cd $(GH_PAGES); git checkout gh-pages >/dev/null -cd $(GH_PAGES); git checkout gh-pages >/dev/null
-cd $(GH_PAGES); git pull -cd $(GH_PAGES); git pull
-cd $(GH_PAGES); ls -A | grep -v '.git$$' | xargs rm -rf -cd $(GH_PAGES); ls -A | grep -v '.git$$' | xargs rm -rf
cp -r $(DOCS_DIST)/* $(GH_PAGES)/ $(MAKE) prepare-gh-pages
touch $(GH_PAGES)/.nojekyll
echo "<html><head><META http-equiv='refresh' content='0;URL=index.html'></head></html>" > $(GH_PAGES)/404.html
cd $(GH_PAGES);\ cd $(GH_PAGES);\
git add --all . ;\ git add --all . ;\
git commit -m "gh-pages: updated" ;\ git commit -m "gh-pages: updated" ;\
git push origin gh-pages git push origin gh-pages
PHONY += travis-gh-pages
travis-gh-pages:
$(MAKE) docs
rm -Rf $(GH_PAGES)
mkdir -p $(GH_PAGES)
$(MAKE) prepare-gh-pages
PHONY += docs-clean PHONY += docs-clean
docs-clean: $(BOOKS_CLEAN) docs-clean: $(BOOKS_CLEAN)