Skip to content
Permalink
Browse files
Update Travis CI guide
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Mar 17, 2017
1 parent 5579947 commit 94dc34ff1d3e9ac59ea15af9e752afa491f68cef
@@ -7,7 +7,7 @@ addons:
packages:
- language-pack-en-base
python:
- 3.5
- 3.6
before_install:
- git config --global user.name 'Travis CI'
- git config --global user.email 'travis@invalid'
@@ -1,6 +1,7 @@
.. title: Automating Nikola rebuilds with Travis CI
.. slug: automating-nikola-rebuilds-with-travis-ci
.. date: 2016-08-24 18:05:25 UTC
.. updated: 2017-03-17 16:20:00 UTC
.. tags: Travis CI, GitHub, automation, tips
.. author: Chris Warrick
.. type: text
@@ -14,8 +15,8 @@ Why?
By using Travis CI to build your site, you can easily blog from anywhere
you can edit text files. Which means you can blog with only a web
browser and `GitHub.com <https://github.com>`_.
You also won’t need to install Nikola and Python to write. Or a real computer,
a mobile phone could probably access one of those services and write something.
You also won’t need to install Nikola and Python to write. You won’t need a
real computer either — a mobile phone could probably access GitHub.com and write something.

Caveats
-------
@@ -31,7 +32,7 @@ What you need

* A computer for the initial setup that can run Nikola and the Travis CI
command-line tool (written in Ruby) — you need a Unix-like system (Linux,
OS X, \*BSD, etc.); Windows users should try *Bash on Ubuntu on Windows*
macOS, \*BSD, etc.); Windows users should try *Bash on Ubuntu on Windows*
(available in Windows 10 starting with Anniversary Update) or a Linux virtual machine.
* A GitHub account (free)
* A Travis CI account linked to your GitHub account (free)
@@ -46,11 +47,19 @@ might also want to add support for `other input formats
Markdown, but this is not a requirement.

After you’re done, you must configure `deploying to GitHub
<https://getnikola.com/handbook.html#deploying-to-github>`_ in Nikola.
Make your first deployment from your local computer and make sure your site
works right. Don’t forget to set up ``.gitignore``. Moreover, you must set
``GITHUB_COMMIT_SOURCE = False`` — otherwise, Travis CI will go into an
infinite loop.
<https://getnikola.com/handbook.html#deploying-to-github>`_ in Nikola. There
are a few important things you need to take care of:

* Make your first deployment from your local computer and make sure your site
works right. Don’t forget to set up ``.gitignore`` (We’ll add two **very**
important entries later.)
* You must set ``GITHUB_COMMIT_SOURCE = False`` — otherwise, Travis CI will go
into an infinite loop.
* We assume your source branch is ``src`` and you deploy to ``master``. Any
other configuration requires editing ``.travis.yml``.
* If you ever commit to ``master`` manually, make sure to add ``[ci skip]`` to
your commit messages, otherwise there might be failed builds (with errors
about ``Rakefile`` missing)

If everything works, you can make some change to your site (so you see that
rebuilding works), but don’t commit it just yet.
@@ -67,7 +76,8 @@ the downloaded file doesn’t have it!)
and adjust the real name, e-mail (used for commits; line 12/13), and the
username/repo name on line 21. If you want to render your site in another
language besides English, add the appropriate Ubuntu language pack to the list
in this file.
in this file. Likewise, if you need any other Python/apt packages to build your
site, add them to your config.

.. listing:: travis.yml python
:linenos:
@@ -91,8 +101,8 @@ And now, time for our venture into the Ruby world. Install the ``travis`` gem:
gem install --user-install travis

You can then use the ``travis`` command if you have configured your ``$PATH``
for RubyGems; if you haven’t, the tool will output a path to use (eg.
``~/.gem/ruby/2.0.0/bin/travis``)
for RubyGems; if you haven’t, the tool will output a path to use on the first
lines (eg. ``~/.gem/ruby/2.0.0/bin/travis``)

We’ll use the Travis CI command-line client to log in (using your GitHub
password), enable the repository and encrypt our SSH key. Run the following
@@ -114,3 +124,5 @@ Commit everything to GitHub:
Hopefully, Travis CI will build your site and deploy. Check the Travis CI
website or your e-mail for a notification. If there are any errors, make sure
you followed this guide to the letter.

(Revision 2, 2017-03-17: added master/src branching information, clarified some things)
@@ -310,6 +310,10 @@ category
Like tags, except each post can have only one, and they usually have
more descriptive names.

guid
String used as GUID in RSS feeds and as ID in Atom feeds instead of the
permalink.

link
Link to original source for content. May be displayed by some themes.

@@ -567,7 +571,8 @@ The ``new_post`` command supports some options:

The optional ``path`` parameter tells Nikola exactly where to put it instead of guessing from your config.
So, if you do ``nikola new_post posts/random/foo.txt`` you will have a post in that path, with
"foo" as its slug.
"foo" as its slug. You can also provide a directory name, in which case Nikola
will append the file name for you (generated from title).

The ``-d, --date-path`` option automates creation of ``year/month/day`` or
similar directory structures. It can be enabled on a per-post basis, or you can
@@ -1481,12 +1486,11 @@ sure you have ``nikola`` and ``git`` installed on your PATH.
will be deployed. It should be ``gh-pages`` for project pages and
``master`` for user pages (user.github.io).
* ``GITHUB_SOURCE_BRANCH`` is the branch where your Nikola site source will be
deployed. We default to ``master``, but user pages should use ``src`` or
something else.
deployed. We recommend and default to ``src``.
* ``GITHUB_REMOTE_NAME`` is the remote to which changes are pushed.
* ``GITHUB_COMMIT_SOURCE`` controls whether or not the source branch is
automatically committed to and pushed. We recommend setting it to
``True``.
``True``, unless you are automating builds with Travis CI.

4. Create a ``.gitignore`` file. We recommend adding at least the following entries:

@@ -2349,12 +2353,16 @@ The following options are recognized:
* clause: attribute comparison_operator value (spaces optional)
* attribute: year, month, day, hour, month, second, weekday, isoweekday; or empty for full datetime
* comparison_operator: == != <= >= < >
* value: integer or dateutil-compatible date input
* value: integer, 'now' or dateutil-compatible date input

* ``tags`` : string [, string...]
Filter posts to show only posts having at least one of the ``tags``.
Defaults to None.

* ``require_all_tags`` : flag
Change tag filter behaviour to show only posts that have all specified ``tags``.
Defaults to False.

* ``categories`` : string [, string...]
Filter posts to show only posts having one of the ``categories``.
Defaults to None.
@@ -1,13 +1,13 @@
/*!
* bootswatch v3.3.6
* bootswatch v3.3.7
* Homepage: http://bootswatch.com
* Copyright 2012-2016 Thomas Park
* Licensed under MIT
* Based on Bootstrap
*/
/*!
* Bootstrap v3.3.6 (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc.
* Bootstrap v3.3.7 (http://getbootstrap.com)
* Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */
@@ -1109,7 +1109,6 @@ a:focus {
text-decoration: underline;
}
a:focus {
outline: thin dotted;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
@@ -2540,7 +2539,6 @@ select[size] {
input[type="file"]:focus,
input[type="radio"]:focus,
input[type="checkbox"]:focus {
outline: thin dotted;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
@@ -3032,7 +3030,6 @@ select[multiple].input-lg {
.btn.focus,
.btn:active.focus,
.btn.active.focus {
outline: thin dotted;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
@@ -6757,7 +6754,7 @@ button.close {
display: none !important;
}
}
.navbar {
.navbar-default {
background-image: -webkit-linear-gradient(#54b4eb, #2fa4e7 60%, #1d9ce5);
background-image: -o-linear-gradient(#54b4eb, #2fa4e7 60%, #1d9ce5);
background-image: -webkit-gradient(linear, left top, left bottom, from(#54b4eb), color-stop(60%, #2fa4e7), to(#1d9ce5));

Large diffs are not rendered by default.

0 comments on commit 94dc34f

Please sign in to comment.