on master help sign in
[mod] .travis.yml: build documentation automatically on the master branch
commit54afe37e18cdbf4fd858907f0a6e83c6cb1c4157 authorAlexandre Flament <alex@al-f.net> dateTue 27 Oct 2020, 13:21 (6 years ago) parent10ddd42
2 files changed+34−3
.travis.yml+22 utils/makefile.sphinx+12−3
.travis.yml+22
@@ -23,6 +23,8 @@ after_success:
2323
2424stages:
2525 - test
26+ - name: documentation
27+ if: env(GITHUB_TOKEN) IS present
2628 - name: docker
2729 if: branch = master AND type != pull_request AND env(DOCKER_USERNAME) IS present
2830
@@ -32,6 +34,26 @@ jobs:
3234 - python: "3.6"
3335 - python: "3.7"
3436 - python: "3.8"
37+ - stage: documentation
38+ python: "3.8"
39+ addons: []
40+ before_install:
41+ - sudo ./utils/searx.sh install buildhost
42+ install: true
43+ script:
44+ - SEARX_DEBUG=1 make travis-gh-pages
45+ after_success: true
46+ deploy:
47+ provider: pages
48+ edge: false
49+ token: $GITHUB_TOKEN # Set in the settings page of your repository, as a secure variable
50+ strategy: git
51+ skip_cleanup: true
52+ keep_history: true
53+ local_dir: gh-pages
54+ target_branch: gh-pages
55+ on:
56+ branch: master
3557 - stage: docker
3658 python: "3.8"
3759 git:
utils/makefile.sphinx+12−3
@@ -168,6 +168,11 @@ $(BOOKS_CLEAN):
168168 $(DOCS_BUILD)/latex/$(patsubst books/%.clean,%,$@)
169169
170170# github pages
171+PHONY += prepare-gh-pages
172+prepare-gh-pages:
173+ cp -r $(DOCS_DIST)/* $(GH_PAGES)/
174+ touch $(GH_PAGES)/.nojekyll
175+ echo "<html><head><META http-equiv='refresh' content='0;URL=index.html'></head></html>" > $(GH_PAGES)/404.html
171176
172177PHONY += $(GH_PAGES)
173178$(GH_PAGES)::
@@ -176,14 +181,18 @@ $(GH_PAGES)::
176181 -cd $(GH_PAGES); git checkout gh-pages >/dev/null
177182 -cd $(GH_PAGES); git pull
178183 -cd $(GH_PAGES); ls -A | grep -v '.git$$' | xargs rm -rf
179− cp -r $(DOCS_DIST)/* $(GH_PAGES)/
180− touch $(GH_PAGES)/.nojekyll
181− echo "<html><head><META http-equiv='refresh' content='0;URL=index.html'></head></html>" > $(GH_PAGES)/404.html
184+ $(MAKE) prepare-gh-pages
182185 cd $(GH_PAGES);\
183186 git add --all . ;\
184187 git commit -m "gh-pages: updated" ;\
185188 git push origin gh-pages
186189
190+PHONY += travis-gh-pages
191+travis-gh-pages:
192+ $(MAKE) docs
193+ rm -Rf $(GH_PAGES)
194+ mkdir -p $(GH_PAGES)
195+ $(MAKE) prepare-gh-pages
187196
188197PHONY += docs-clean
189198docs-clean: $(BOOKS_CLEAN)