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

jus deploy gh-pages idea #34

Closed
billiegoose opened this issue Sep 7, 2016 · 4 comments
Closed

jus deploy gh-pages idea #34

billiegoose opened this issue Sep 7, 2016 · 4 comments
Labels

Comments

@billiegoose
Copy link
Member

I see in the documentation http://jus.js.org/#deployment-to-github-pages you've got:

Add the following to your package.json:

{
 "scripts": {
   "start": "jus serve",
   "deploy": "npm run build && npm run commit && npm run push && npm run open",
   "build": "jus build . dist",
   "commit": "git add dist && git commit -m 'update dist'",
   "push": "git subtree push --prefix dist origin gh-pages",
   "open": "open http://zeke.sikelianos.com"
 }
}

I cooked up something similar for my website, but tried to make it slightly more magical:

  "gh-pages": {
    "branch": "master",
    "url": "https://github.com/verifiedmodules/verifiedmodules.github.io"
  },
  "scripts": {
    "start": "jus serve",
    "build": "jus build . dist",
    "deploy": "bash .bin/deploy.sh"
  },
  "homepage": "https://verifiedmodules.github.io",
#!/usr/bin/env bash
# ./bin/deploy.sh
rm -rf dist .gh-pages
jus build . dist
git clone $npm_package_gh_pages_url .gh-pages --branch $npm_package_gh_pages_branch --bare --depth 1
git --git-dir=.gh-pages --work-tree=dist add -A
git --git-dir=.gh-pages --work-tree=dist commit -m deploy
git --git-dir=.gh-pages --work-tree=dist push $npm_package_gh_pages_url $npm_package_gh_pages_branch
opener $npm_package_homepage

It's magical because it a) uses package.json to hold the parameters, and b) manages to update the github pages branch without altering the current branch or copying any of the files in the project directory or the dist directory. (I may or may not have spent a few mythical man days of my life learning to bend git to my will while building a CI system...)

I was thinking, I could re-write the shell script in Node to remove the Bash dependency. And with some heuristics, I could probably automatically figure out which branch (gh-pages, master, or docs) and repo (either repository.url in package.json, or inferred from homepage in package.json if homepage contains 'github.io'?) to push to, so it could be zero configuration. Would you be interested in including this? I was thinking of just jus, but come to think of it I could make it a regular npm module. But the gist of it is, I'd like "deploy" to be as drop-dead simple as "serve" and "build". Everyone should be able to publish to gh-pages without complex configuring.

@zeke
Copy link
Member

zeke commented Sep 8, 2016

I may or may not have spent a few mythical man days of my life learning to bend git to my will while building a CI system

Ha!

Would you be interested in including this?

Yes. I love the concept. I am not especially happy with the current state of the art. That problem of mucking with the git history is precisely why I've been using surge.sh instead of GitHub Pages.

@billiegoose
Copy link
Member Author

@zeke
Copy link
Member

zeke commented Sep 12, 2016

Watching that repo. :)

@billiegoose
Copy link
Member Author

Just to update this issue and bring it to a close -- shortly after reading your comment I tried surge for the first time, and I promptly quit using GitHub Pages. 😆 For new projects I have started using either surge or now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants