Skip to content

Instantly share code, notes, and snippets.

@mrkrstphr
Last active February 5, 2019 13:17
Show Gist options
  • Select an option

  • Save mrkrstphr/2e79e55229b2ef7a343a to your computer and use it in GitHub Desktop.

Select an option

Save mrkrstphr/2e79e55229b2ef7a343a to your computer and use it in GitHub Desktop.

Revisions

  1. mrkrstphr revised this gist Sep 5, 2014. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -77,4 +77,6 @@ git checkout drafts
    git stash pop
    ```

    Slightly different, same concept.
    Slightly different, same concept.

    Thanks to [@beausimensen](https://twitter.com/beausimensen) for the `--env=prod` suggestion.
  2. mrkrstphr revised this gist Sep 5, 2014. 1 changed file with 7 additions and 6 deletions.
    13 changes: 7 additions & 6 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -14,13 +14,13 @@ I wanted to be able to use [Sculpin](https://sculpin.io/) to generate GitHub pag
    exit 1;
    fi

    sculpin generate
    sculpin generate --env=prod

    git stash
    git checkout gh-pages

    cp -R output_dev/* .
    rm -rf output_dev
    cp -R output_prod/* .
    rm -rf output_*

    git add *
    git commit -m "$1"
    @@ -61,12 +61,13 @@ if [ $# -ne 1 ]; then
    exit 1;
    fi
    sculpin generate
    sculpin generate --env=prod
    git stash
    git checkout master
    cp -R output_dev/* .
    rm -rf output_dev
    cp -R output_prod/* .
    rm -rf output_*
    git add *
    git commit -m "$1"
  3. mrkrstphr revised this gist Sep 5, 2014. 1 changed file with 38 additions and 2 deletions.
    40 changes: 38 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -15,9 +15,12 @@ I wanted to be able to use [Sculpin](https://sculpin.io/) to generate GitHub pag
    fi

    sculpin generate

    git stash
    git checkout gh-pages

    cp -R output_dev/* .
    rm -rf output_dev

    git add *
    git commit -m "$1"
    @@ -36,8 +39,41 @@ I wanted to be able to use [Sculpin](https://sculpin.io/) to generate GitHub pag
    3. Checkout the `gh-pages` branch
    4. Move the generated site to the root of the project
    5. `git add -A` to add all the files
    6. `git commit -m "$#"` which includes whatever commit message you passed to `./publish.sh`
    6. `git commit -m "$1"` which includes whatever commit message you passed to `./publish.sh`
    7. `git push origin --all` to push changes to both `master` and `gh-pages` to GitHub
    8. Checkout `master`, and pop the stash to get any stashed changes to master back

    It works pretty fantastically. You can checkout [my sample project](https://github.com/familytree/familytree.github.io) to see how it works.
    It works pretty fantastically. You can checkout [my sample project](https://github.com/familytree/familytree.github.io) to see how it works.

    ## Organization/User Pages

    The process described above works for project sites, because project sites use a `gh-pages` branch for the website. Organization and user pages, however, use the `master` branch for the site of a repository named *[organization].github.io*.

    In the case of [my sample project](https://github.com/familytree/familytree.github.io), I actually use a branch called `drafts` to do the Sculpin work, which then "publishes" the changes to `master`, so that the website actually renders correctly.

    The `publish.sh` looks like this:

    ```bash
    #!/bin/bash
    if [ $# -ne 1 ]; then
    echo "usage: ./publish.sh \"commit message\""
    exit 1;
    fi
    sculpin generate
    git stash
    git checkout master
    cp -R output_dev/* .
    rm -rf output_dev
    git add *
    git commit -m "$1"
    git push origin --all
    git checkout drafts
    git stash pop
    ```

    Slightly different, same concept.
  4. mrkrstphr created this gist Sep 5, 2014.
    43 changes: 43 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,43 @@
    # Deploying Sculpin Sites to GitHub Pages

    I wanted to be able to use [Sculpin](https://sculpin.io/) to generate GitHub pages. Here's what I did...

    1. Created a super awesome Sculpin site from the Sculpin Blog Skeleton
    2. Make sure everything is under version control in my `master` branch (except things that shouldn't be. see the `.gitignore`)
    3. Updated `publish.sh`:

    ```bash
    #!/bin/bash

    if [ $# -ne 1 ]; then
    echo "usage: ./publish.sh \"commit message\""
    exit 1;
    fi

    sculpin generate
    git stash
    git checkout gh-pages
    cp -R output_dev/* .

    git add *
    git commit -m "$1"
    git push origin --all

    git checkout master
    git stash pop

    ```
    4. Now, when I need to publish, I simply run `./publish.sh "commit message"`.

    `publish.sh` will:

    1. generate the site using `sculpin generate`
    2. Stash the changes to `master`, if any
    3. Checkout the `gh-pages` branch
    4. Move the generated site to the root of the project
    5. `git add -A` to add all the files
    6. `git commit -m "$#"` which includes whatever commit message you passed to `./publish.sh`
    7. `git push origin --all` to push changes to both `master` and `gh-pages` to GitHub
    8. Checkout `master`, and pop the stash to get any stashed changes to master back

    It works pretty fantastically. You can checkout [my sample project](https://github.com/familytree/familytree.github.io) to see how it works.