Skip to content

Instantly share code, notes, and snippets.

@joekarasek
Last active August 25, 2016 16:37
Show Gist options
  • Save joekarasek/d32875162412d70390a4e1aa524d3aa1 to your computer and use it in GitHub Desktop.
Save joekarasek/d32875162412d70390a4e1aa524d3aa1 to your computer and use it in GitHub Desktop.
Github pages deploy setup for ember

Setup

Add this to config/environment.js:

if (environment === 'production') {
  ENV.baseURL = '/GITHUB-REPO-NAME/dist';
  ENV.locationType = 'hash';
}

Place the .sh file in scripts/ folder.

To Use

bash scripts/deploy-to-github-pages.sh

NOTE: If you are an Epicodus student trying to figure this out, there are some bugs related to personal computer settings. Message me if you have problems.

echo "Switch to gh-pages branch"
git checkout gh-pages
git merge master
echo "Clean up"
rm -rf dist
echo "Create new production build"
ember build --environment production
echo "Add dist to commit and push it to GitHub"
git add dist --force
git commit -m "deploy"
git push
echo "Switch back to master branch"
git checkout master
<html>
<head>
<meta http-equiv="refresh" content="1;http://joekarasek.github.io/GITHUB-REPO-NAME/dist/index.html" />
</head>
<body>
</body>
</html>
@joekarasek
Copy link
Author

Taylor, thanks for the step-by-step!

@Jordan-Meier
Copy link

This is so helpful! Thanks, guys!

@mknutgit
Copy link

mknutgit commented Aug 25, 2016

This was a life saver, thanks so much!

Wanted to add a couple more steps for when you make updates to the site and need to refresh the gh-pages. May be obvious, but wanted to document it.

  1. $git checkout gh-pages
  2. $git merge master
  3. $ember build --environment production
  4. $git add --force dist
  5. $ commit.
    6 $git push (remote-repo-name) gh-pages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment