In which I ramble a bit about setting up CI for this very blog.
I have a Jenkins server running on my OsX computer. (… or … I’m setting one up anyway) I also have (am establishing?) a blog built by Hexo … because that seems the right way to do this sort of thing. My constraints of “MarkDown” and “no really - let me use MarkDown because I’m going to have a lot of code fragments” seem alien to most blogging software - “Hexo delivers” as the kids say.
I knew that this would all work from a command line on the computer and a command line on my Windows 7 PC. After a bunch of chewing - I’ve scrawled this post in victory as a sort of test.
Hexo is built in Node.JS. I installed it and played about with it as I was instructed.
npm install hexo npm install hexo-generator-sitemap --save
After installing Node.JS I encountered various errors and I switching to a stable version of NPM. (… which I thought I had already used but … I guess not)
npm -g install npm
This was discussed here but may be irrelevant.
I setup Jenkins to poll (and pull) my repository at
H/15 * * * *.
I had already setup a Hexo site and configured it to deploy to GitHub pages.
(… which incidentally don’t seem to do anything interesting for you with Jekyll AFAIK)
The “secret” to this recipe seemed to be that the Jenkins build seems to require installing Hexo itself to work.
npm install in the folder but full-on
npm install hexo et al.
This seems odd to me but it’s what worked … but this is a CI server so longish builds are fine with me.
I used four steps, each a shell command, to perform the generation and deploy the site.
The first command installs Hexo.
I tried to install it (globally?) with
-g but encountered a security exception.
npm install hexo
The second command installs a sitemap plugin that should make my site reachable from Google-like crawlers
npm install hexo-generator-sitemap --save
The third command … installs … the site? This may be redundant but I’m not interested in going through a “change” > “reboot” > “check” cycle to learn that I’ve broken my configuration.
The fourth command actually generates the site and uploads the generated site.
It seems odd to me
deploy doesn’t implicitly generate the site - but I can take advantage of that, see the Addendum!
hexo deploy --generate
So … yeah … that’s that. This post was the first one that I set to push out through this system.
So it’s been a few weeks/months and I want to stick generated HTML from somewhere else onto my site.
But … Hexo tries to “fill in the blanks” which keeps a consistent CSS and
<title> stuff … but breaks my Unity WebGL game.
To work around this, I’ve
* generated the WebGL to an
assets/ folder and committed it to the blog’s repository
* an explanation of this is beyond the scope of this post … I’ll write it up another time
* split generation and deployment into two steps
* copied the
assets/ folder into the blog’s
* deployed everything as normal
The fourth step above is replaced with these three commands;
hexo generate cp -r assets/* public/ hexo deploy
… and it works!