update-gh-pages.sh 974 B

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/bash
  2. # log
  3. echo "..."
  4. echo "Updating Github.io page"
  5. echo "..."
  6. # Generate index.html and /temp assets for GH Pages branch
  7. grunt build-gh-pages
  8. # Create temporary copy of index file
  9. cp index.html index-temp.html
  10. # Checkout to `gh-pages` branch
  11. git checkout -B gh-pages origin/gh-pages
  12. git pull -r origin gh-pages
  13. # Replace current files with temporary files
  14. mv index-temp.html index.html
  15. cp node_modules/bootstrap/dist/css/bootstrap.min.css css/bootstrap.min.css
  16. mv temp/bootstrap-slider.css css/bootstrap-slider.css
  17. mv temp/bootstrap-slider.js js/bootstrap-slider.js
  18. # Remove /temp directory
  19. rm -rf temp
  20. # Stage new files for commit
  21. git add index.html css/bootstrap-slider.css js/bootstrap-slider.js css/bootstrap.min.css
  22. # Create commit with new files
  23. git commit -m "updates"
  24. # Push new source code to gh-pages branch
  25. git push origin gh-pages:gh-pages -f
  26. # Switch back to master branch
  27. git checkout master
  28. # log
  29. echo "..."
  30. echo "Github.io page updated"
  31. echo "..."