After a couple hesitating months to move to github pages, and from my hacked together static site generator, yesterday was my 4th attempt in getting started with github pages blogging, just because there where a few annoyances with the different variations I've tried.
Decided to go with Octopress, just for their nice logo. And for their Github pages oriented focus. That didn't pan out, but at least I learned a few things about their blogging process and setup, which I'm adapting for sculpin.
Because "talk is cheap, show
me the code
", I will assume you have the appropiate Github Pages repository created and
left empty, the following script will setup everything for publishing.
#!/bin/sh
#
# Example invocation: ./script.sh mhitza.github.io git@github.com:mhitza/mhitza.github.io.git
TARGETDIR=$1
REPOSITORY=$2
mkdir $TARGETDIR && cd $TARGETDIR
# Get sculpin and run a first generate run to have the skeleton up as a test page
# Also composer is required for sculpin dependencies; it's invoked by sculpin install
git clone https://github.com/sculpin/sculpin-blog-skeleton.git .
curl -sS https://getcomposer.org/installer | php
curl -O https://download.sculpin.io/sculpin.phar
chmod +x sculpin.phar
./sculpin.phar install
./sculpin.phar generate --env=prod
# This folder will contain the generated files, and it will be the first branch to
# get pushed, because of Github specifics
#
# From http://octopress.org/docs/deploying/github/:
# With new repositories, Github sets the default branch based on the branch you push first,
# and it looks there for the generated site content. If you're having trouble getting Github
# to publish your site, go to the admin panel for your repository and make sure that the master
# branch is the default branch.
cd output_prod/
git init .
git remote add origin $REPOSITORY
git add .
git commit -m "Site generated at `date`"
git push -u origin master
cd ..
# Keep this upstream around if we want to update sculpin later
git remote rename origin upstream
git remote add origin $REPOSITORY
# This is the main branch we "work" on since here we keep the source markdown/textile files
git branch -m source
echo "composer.phar" >> .gitignore
echo "sculpin.phar" >> .gitignore
git add -A .
git commit -m "Sculpin setup"
git push -u origin source
## Copyright 2014 Marius Ghita
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
This is a use once script, and "tested" accordingly but hopefully it will get you the setup it promises.