mirror of
https://github.com/almet/notmyidea.git
synced 2025-04-28 19:42:37 +02:00
Use travis to publish the blog
This commit is contained in:
parent
1a551941be
commit
51bda908fd
5 changed files with 72 additions and 15 deletions
64
Makefile
64
Makefile
|
@ -1,17 +1,57 @@
|
||||||
PELICAN=pelican
|
PELICANOPTS=
|
||||||
|
|
||||||
html:
|
BASEDIR=$(CURDIR)
|
||||||
$(PELICAN) -s pelican.conf.py content
|
INPUTDIR=$(BASEDIR)/content
|
||||||
|
OUTPUTDIR=$(BASEDIR)/output
|
||||||
|
CONFFILE=$(BASEDIR)/pelicanconf.py
|
||||||
|
PUBLISHCONF=$(BASEDIR)/publishconf.py
|
||||||
|
|
||||||
upload: html
|
VENV := $(shell echo $${VIRTUAL_ENV-$(shell pwd)/.venv})
|
||||||
rsync -P -rvz --delete output/* artichaut:/home/www/blog.notmyidea.org
|
VIRTUALENV = virtualenv -p /usr/bin/python3.6
|
||||||
|
INSTALL_STAMP = $(VENV)/.install.stamp
|
||||||
|
|
||||||
serve: html
|
PYTHON=$(VENV)/bin/python
|
||||||
cd output && python -m pelican.server 8000&
|
PELICAN=$(VENV)/bin/pelican
|
||||||
|
PIP=$(VENV)/bin/pip
|
||||||
|
|
||||||
regenerate: serve
|
DEBUG ?= 0
|
||||||
$(PELICAN) -r -s pelican.conf.py content
|
ifeq ($(DEBUG), 1)
|
||||||
|
PELICANOPTS += -D
|
||||||
|
endif
|
||||||
|
|
||||||
github: html
|
install: $(INSTALL_STAMP)
|
||||||
ghp-import -n $(OUTPUTDIR)
|
$(INSTALL_STAMP): $(PYTHON) requirements.txt
|
||||||
@git push -fq https://${GH_TOKEN}@github.com/$(TRAVIS_REPO_SLUG).git gh-pages > /dev/null
|
$(VENV)/bin/pip install -r requirements.txt
|
||||||
|
touch $(INSTALL_STAMP)
|
||||||
|
|
||||||
|
virtualenv: $(PYTHON)
|
||||||
|
$(PYTHON):
|
||||||
|
$(VIRTUALENV) $(VENV)
|
||||||
|
|
||||||
|
html: install
|
||||||
|
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
[ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR)
|
||||||
|
rm -rf $(VENV)
|
||||||
|
|
||||||
|
serve: install
|
||||||
|
ifdef PORT
|
||||||
|
cd $(OUTPUTDIR) && $(PYTHON) -m pelican.server $(PORT)
|
||||||
|
else
|
||||||
|
cd $(OUTPUTDIR) && $(PYTHON) -m pelican.server 8000
|
||||||
|
endif
|
||||||
|
|
||||||
|
regenerate:
|
||||||
|
cd $(OUTPUTDIR) && $(PYTHON) -m pelican.server &
|
||||||
|
$(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
|
||||||
|
|
||||||
|
publish: install
|
||||||
|
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS)
|
||||||
|
echo "blog.notmyidea.org" > $(OUTPUTDIR)/CNAME
|
||||||
|
|
||||||
|
github: publish
|
||||||
|
ghp-import -n $(OUTPUTDIR)
|
||||||
|
@git push -fq https://${GH_TOKEN}@github.com/$(TRAVIS_REPO_SLUG).git gh-pages > /dev/null
|
||||||
|
|
||||||
|
.PHONY: html clean serve devserver publish
|
||||||
|
|
19
publishconf.py
Normal file
19
publishconf.py
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*- #
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
# This file is only used if you use `make publish` or
|
||||||
|
# explicitly specify it as your config file.
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
sys.path.append(os.curdir)
|
||||||
|
from pelicanconf import * # NoQA
|
||||||
|
|
||||||
|
SITEURL = 'https://blog.notmyidea.org'
|
||||||
|
RELATIVE_URLS = False
|
||||||
|
|
||||||
|
FEED_ALL_ATOM = 'feeds/all.atom.xml'
|
||||||
|
CATEGORY_FEED_ATOM = 'feeds/%s.atom.xml'
|
||||||
|
|
||||||
|
DELETE_OUTPUT_DIRECTORY = True
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
pelican
|
|
@ -22,9 +22,6 @@
|
||||||
{% if FEED_RSS %}
|
{% if FEED_RSS %}
|
||||||
<link href="{{ FEED_DOMAIN }}/{{ FEED_RSS }}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} RSS Feed" />
|
<link href="{{ FEED_DOMAIN }}/{{ FEED_RSS }}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} RSS Feed" />
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if CATEGORY_FEED_ATOM and category %}
|
|
||||||
<link href="{{ FEED_DOMAIN }}/{{ CATEGORY_FEED_ATOM|format(category.slug) }}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} Categories Atom Feed" />
|
|
||||||
{% endif %}
|
|
||||||
{% if CATEGORY_FEED_RSS and category %}
|
{% if CATEGORY_FEED_RSS and category %}
|
||||||
<link href="{{ FEED_DOMAIN }}/{{ CATEGORY_FEED_RSS|format(category.slug) }}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} Categories RSS Feed" />
|
<link href="{{ FEED_DOMAIN }}/{{ CATEGORY_FEED_RSS|format(category.slug) }}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} Categories RSS Feed" />
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Reference in a new issue