Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should be able to publish to GitHub #63

Open
simensen opened this issue Jan 2, 2013 · 15 comments
Open

Should be able to publish to GitHub #63

simensen opened this issue Jan 2, 2013 · 15 comments
Labels
enhancement pending review Pending a decision on a path forward for older issues

Comments

@simensen
Copy link
Member

simensen commented Jan 2, 2013

No description provided.

@Incognito
Copy link

My ideal use of this function would be to publish the static site to gh-pages while keeping the build files in master, but this may be limited to myself.

@simensen
Copy link
Member Author

simensen commented Jan 3, 2013

I'll look at how other implementations are currently doing this but I'm thinking it would make sense to somehow create a clone specifically for deployment purposes. app/config/sculpin_kernel.yml would look something like this:

sculpin_deploy_git:
    url: git@github.com:user/example.com.git
    reference: gh-pages

I envision fetching reference (gh-pages in this example) and then copying the target directory over whatever is in the deploy clone then a fresh commit and push -f.

@Incognito Would this work for you? Do you have other input?

@Incognito
Copy link

That's a great solution as the history of gh-pages shouldn't be important, it's simply where the static site happens to go. It has very little need to be git-powered.

@reinink
Copy link
Contributor

reinink commented Jan 21, 2014

As @simensen knows, I'd love to see this featured added to Sculpin. And my hunch is that many developers using Sculpin are probably taking advantage of GitHub Pages for their hosting...it may even be the reason they're using Sculpin.

I just came across this article, and thought I'd add it to this ticket. They are doing something very similar, except deploying from Travis-CI.

@simensen simensen modified the milestone: Version 2.0 Dec 23, 2014
@mdrmike
Copy link
Contributor

mdrmike commented Mar 19, 2015

I have the same use case ... actually surprised this wasn't built-in once I started getting into. This deploy script: https://gist.github.com/mrkrstphr/2e79e55229b2ef7a343a seems like a useful place to start / reference... though prefer it were a sculpin command, not a separate shell script.

@endafarrell
Copy link

+1
I too have been trying out https://gist.github.com/mrkrstphr/2e79e55229b2ef7a343a but GitHub Pages states "Your site is having problems building: Page build failed. For more information, see https://help.github.com/articles/troubleshooting-github-pages-build-failures." I'm trying to find out why.

@atelierbram
Copy link

I understand this is about a build-in solution, but now that gh-pages publishing has become much simpler with GitHub's default docs folder, maybe an option for easily configuring a different name for the output_prod/_posts folder could be one "work around'. (Maybe the option is already available, but I couldn't find one. Using the grunt-gh-pages plugin myself, which works also fine for me, really).

@Xerkus
Copy link
Member

Xerkus commented Mar 9, 2017

@atelierbram i will take a look for a way to change output folder for a target, in the meantime you can symlink docs/ to output_prod/

@Xerkus
Copy link
Member

Xerkus commented Mar 9, 2017

currently i use .sh script to deploy, can easily be adapted for travis
source is in sculpin branch and gh-pages branch is master

#!/usr/bin/env bash

set -e

REQUIRED_BRANCH="sculpin"

if [ "$1" != "force" ] && \
  [ "$(git symbolic-ref -q HEAD 2>/dev/null)" != "refs/heads/$REQUIRED_BRANCH" ]
then
    >&2 echo "It appears we are not in '$REQUIRED_BRANCH' branch."
    >&2 echo "Aborting..."
    exit 1
fi

# intentionally not possible to deploy if uncommitted changes are present
if [ "$1" != "force" ] && [ "$(git status --porcelain | wc -l)" -ne 0 ]
then
    >&2 echo "Working copy is dirty:"
    >&2 git status --short
    >&2 echo "Aborting..."
    exit 1
fi

CURR_COMMIT=$(git rev-parse --short HEAD)

rm -rf ./output_prod
./vendor/bin/sculpin generate --env=prod
echo

rm -rf ./.gh-pages-publish
git clone https://github.com/Xerkus/repo.git -b master --depth 1 \
    ./.gh-pages-publish
cd .gh-pages-publish

rsync --quiet --archive \
    --filter="P .git*" --filter="P CNAME" --filter="P .nojekyll" \
    --delete ../output_prod/ ./
rm -rf ../output_prod

git add -A :/
# non-zero exit code on no changes, no new commit or pushing
# should probably check for staged changes in git index
git commit -a -m "Deploying sculpin-generated pages at #$CURR_COMMIT"

if [ "$1" == "push" ]
then
    git push origin master
    echo "Done and pushed"
    exit
fi

echo "Done. Now cd to .gh-pages-publish, verify and push to origin master"

@Xerkus
Copy link
Member

Xerkus commented Mar 9, 2017

@atelierbram output can be set to docs/ via sculpin.output_dir config option in sculpin_kernel.yml, but as far as i can tell, there is no way to set per target output directory currently.

@atelierbram
Copy link

@Xerkus Thanks for your research; I am going to look into this.

@Incognito
Copy link

This is exciting and one of the original features I wanted early on.

@atelierbram
Copy link

atelierbram commented Mar 11, 2017

output can be set to docs/ via sculpin.output_dir config option in sculpin_kernel.yml

@Xerkus I tested this and it works, great! @Incognito exciting indeed!

there is no way to set per target output directory currently

An option to omit this _posts -directory as a wrapper for the posts would be great for this use case, so yes please ;) can already be done with permalink: /:basename/

sculpin:
  output_dir: docs
sculpin_content_types:
  posts:
    permalink: /:basename/ 

You can't beat simplicity, it totally works! What's great about this, I think, is that one doesn't have to use elaborate scripts or build-tool-plugins to publish on GitHub anymore: just use their API and let them take care of it. So as far as I am concerned this issue is solved and can be closed, but should be documented, something like this

@arysom
Copy link

arysom commented Jun 10, 2018

Here's my take on publish to github pages. I've used link pointed by mdrmike 's as inspiration and some generator that already breathes sculpin's neck, with one force.

I know you may not like, that the source of the blog is XX commit's behind master etc. but for me it's simple and ok. The directory goes as a subtree to master.

@Incognito
Copy link

There's an interesting solution a jekyll user is using, which is 100% compatible with sculpin.

https://devlopr.netlify.com/guides/2019/05/21/deploy-blog-using-devlopr-jekyll-and-github-pages/

@beryllium beryllium added the pending review Pending a decision on a path forward for older issues label Feb 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement pending review Pending a decision on a path forward for older issues
Projects
None yet
Development

No branches or pull requests

9 participants