Skip to content

Instantly share code, notes, and snippets.

@Deborah-Digges
Last active September 25, 2020 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Deborah-Digges/41a4775a088c66960146c5dc10f1c232 to your computer and use it in GitHub Desktop.
Save Deborah-Digges/41a4775a088c66960146c5dc10f1c232 to your computer and use it in GitHub Desktop.
gatsby-deploy
language: node_js
before_script:
- npm install -g gatsby-cli
node_js:
- "10"
script: git config --global user.email $GH_EMAIL 2> /dev/null &&
git config --global user.name $GH_USERNAME 2> /dev/null &&
git remote set-url origin "https://${GH_USERNAME}:${GH_TOKEN}@github.com/deborah-digges/deborah-digges.github.io.git" 2> /dev/null &&
yarn install && yarn run deploy 2> /dev/null
git config --global user.name $GH_USERNAME
git config --global user.email $GH_EMAIL
git remote set-url origin "https://${GH_USERNAME}:${GH_TOKEN}@github.com/deborah-digges/
git checkout -b gh-pages
gatsby build
# Temporarily move the public folder
mv public /tmp
# Remove all other files
rm -r *
# Move the contents of the public folder back to the root of the directory
cp -r /tmp/public/* .
git commit -m "Release new version of blog"
git push origin gh-pages
"scripts": {
...
"build": "gatsby build",
}
{
...
"homepage": "deborah-digges.github.io",
...
}
"scripts": {
"build": "gatsby build",
"deploy": "npm run build && gh-pages -d public",
}
➜ cd public
➜ http-server
Starting up http-server, serving ./
Available on:
http://127.0.0.1:8082
http://10.10.10.10:8082
http://192.168.13.12:8082
yarn add gh-pages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment