Skip to content

Commit f264ffe

Browse files
committed
scripts: github pages publishing
1 parent 26c7f1d commit f264ffe

File tree

5 files changed

+57
-9
lines changed

5 files changed

+57
-9
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/.build/
2+
/_pages/

Makefile

+17-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ SPHINXOPTS =
66
SPHINXBUILD = sphinx-build
77
PAPER =
88
BUILDDIR = .build
9+
PUBLISHDIR = _pages
910

1011
# User-friendly check for sphinx-build
1112
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
12-
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
13+
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you do not have Sphinx installed, grab it from http://sphinx-doc.org/)
1314
endif
1415

1516
# Internal variables.
@@ -23,6 +24,7 @@ I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
2324

2425
help:
2526
@echo "Please use \`make <target>' where <target> is one of"
27+
@printf " %-10s to make standalone HTML files in $(PUBLISHDIR)/ directory\n" $(PUBLISHDIR)
2628
@echo " html to make standalone HTML files"
2729
@echo " dirhtml to make HTML files named index.html in directories"
2830
@echo " singlehtml to make a single large HTML file"
@@ -48,9 +50,22 @@ help:
4850
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
4951
@echo " coverage to run coverage check of the documentation (if enabled)"
5052

51-
clean:
53+
clean: clean-$(PUBLISHDIR)
5254
rm -rf $(BUILDDIR)/*
5355

56+
.PHONY: clean-$(PUBLISHDIR)
57+
clean-$(PUBLISHDIR):
58+
rm -rf $(PUBLISHDIR)/* $(PUBLISHDIR)/.buildinfo
59+
60+
.PHONY: $(PUBLISHDIR)
61+
$(PUBLISHDIR): clean-$(PUBLISHDIR)
62+
@test -d $(PUBLISHDIR) || \
63+
{ 2>&1 echo "error: directory missing $(PUBLISHDIR)/"; exit 1; }
64+
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(PUBLISHDIR)
65+
@rm $(PUBLISHDIR)/.buildinfo
66+
@echo
67+
@echo "Build finished. The HTML pages are in $(PUBLISHDIR)/."
68+
5469
html:
5570
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
5671
@echo

README.md

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Notes
2+
3+
These are some notes I want to keep around.
4+
5+
# Setup
6+
7+
```
8+
git clone [email protected]:Sarcasm/notes.git
9+
cd notes
10+
git fetch origin gh-pages
11+
git checkout gh-pages
12+
git checkout master
13+
git worktree add --checkout _pages gh-pages
14+
# configure `git push` to push both branches
15+
git config remote.origin.push refs/heads/master:refs/heads/master
16+
git config --add remote.origin.push refs/heads/gh-pages:refs/heads/gh-pages
17+
```
18+
19+
# Publish changes
20+
21+
After a change has been committed to the main branch, it's possible to publish
22+
using this procedure:
23+
24+
```
25+
make _pages
26+
./commit-pages.sh
27+
git push
28+
```

commit-pages.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
set -o errexit
4+
5+
commit_msg=$(git log -1 --pretty=tformat:"publish %h: %s")
6+
cd _pages
7+
git add .
8+
git commit -m "$commit_msg"

conf.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,11 @@
55
# containing dir.
66
#
77

8-
import sys
9-
import os
10-
import shlex
11-
128
# -- General configuration ------------------------------------------------
139

1410
# General information about the project.
1511
project = 'Sarcasm tips'
16-
copyright = '2015, Guillaume Papin'
12+
copyright = '2016, Guillaume Papin'
1713
author = 'Guillaume Papin'
1814

1915
# The version info for the project you're documenting, acts as replacement for
@@ -66,7 +62,7 @@
6662
nitpicky = True
6763

6864
# Add any paths that contain templates here, relative to this directory.
69-
templates_path = ['.templates']
65+
templates_path = [] # '.templates'
7066

7167
# If true, '()' will be appended to :func: etc. cross-reference text.
7268
#add_function_parentheses = True
@@ -125,7 +121,7 @@
125121
# Add any paths that contain custom static files (such as style sheets) here,
126122
# relative to this directory. They are copied after the builtin static files,
127123
# so a file named "default.css" will overwrite the builtin "default.css".
128-
html_static_path = ['.static']
124+
html_static_path = [] # '.static'
129125

130126
# Add any extra paths that contain custom files (such as robots.txt or
131127
# .htaccess) here, relative to this directory. These files are copied

0 commit comments

Comments
 (0)