Clean system for github pages with local plugins

Since github does not execute (plugins safefor jekyll), I am trying to develop a small and clean way to deploy compiled files to a branch master.

The usual source is in the branch boilerplate, from there I run jekyll and generate the code, everything works.

In the main branch I only have Makefile

default:
    git checkout boilerplate
    git subtree split -P _site -b site
    git checkout master
    git merge -X theirs site
    git branch -D site

and file .nojekyll(I use the subtree command here )

However, this does not work. It generates a branch sitewith all the code, but when I merge in master, all it says is:

Already updated.

How to fix it?

master, , site (, Makefile .nojekyll), , ).

. , . 1. 2. .

+3
1

IRC, git (git help hooks)

this script . $GIT_DIR/.git/hooks/.

, $_origbranch, ($_destbranch).

, . , , .

#!/usr/bin/env bash

# executables prefix
_prefix="/usr/bin"
# git executable
_git="$_prefix/git"

# site generation executable
_generate="$_prefix/jekyll"
# options for the generator
_opts=(--no-safe --no-server --no-auto --kramdown)

# branch from which to generate site
_origbranch="master"
# branch holding the generated site
_destbranch="gh-pages"

# directory holding the generated site -- should be outside this repo
_site="$("$_prefix/mktemp" -d /tmp/_site.XXXXXXXXX)"
# the current branch
_currbranch="$(/bin/grep "^*" < <("$_git" branch) | /bin/cut -d' ' -f2)"

if [[ $_currbranch == $_origbranch ]]; then # we should generate the site
    # go to root dir of the repo
    cd "$("$_git" rev-parse --show-toplevel)"
    # generate the site
    "$_generate" ${_opts[@]} . "$_site"
    # switch to branch the site will be stored
    "$_git" checkout "$_destbranch"
    # overwrite existing files
    builtin shopt -s dotglob
    /bin/cp -rf "$_site"/* .
    builtin shopt -u dotglob
    # add any new files
    "$_git" add .
    # commit all changes with a default message
    "$_git" commit -a -m "updated site @ $(date +"%F %T")"
    # cleanup
    /bin/rm -rfv "$_site"
    # return
    "$_git" checkout "$_origbranch"
fi

o/


, , bash Linux. , POSIX sh. , , mktemp GNU-coreutils, , , .

: , $_origbranch. , , . , , - .

+15

All Articles