| 1 | #!/bin/bash -eu |
| 2 | |
| 3 | # This script builds a new gh-pages branch from latest master |
| 4 | |
| 5 | read -p "This script will delete all untracked files in the VE folder. Continue (y/n)? " -n 1 -r |
| 6 | echo |
| 7 | if [[ ! $REPLY =~ ^[Yy]$ ]] |
| 8 | then |
| 9 | exit 0 |
| 10 | fi |
| 11 | |
| 12 | cd "$(dirname $0)/.." |
| 13 | git fetch origin |
| 14 | git checkout -B gh-pages origin/master |
| 15 | git reset --hard origin/master |
| 16 | |
| 17 | git clean -dffx |
| 18 | # Run npm-install to fetch qunitjs and build dist/ |
| 19 | npm install |
| 20 | |
| 21 | html='<!DOCTYPE html> |
| 22 | <meta charset="utf-8"> |
| 23 | <title>VisualEditor</title> |
| 24 | <link rel=stylesheet href="lib/oojs-ui/oojs-ui-apex.css"> |
| 25 | <link rel=stylesheet href="demos/ve/demo.css"> |
| 26 | <style> |
| 27 | article { |
| 28 | margin: 1em auto; |
| 29 | width: 45em; |
| 30 | max-width: 80%; |
| 31 | text-align: center; |
| 32 | } |
| 33 | article img { |
| 34 | max-width: 100%; |
| 35 | } |
| 36 | </style> |
| 37 | <article> |
| 38 | <img src="demos/ve/VisualEditor-logo.svg" alt="VisualEditor logo"> |
| 39 | <div class="oo-ui-widget oo-ui-widget-enabled oo-ui-buttonElement oo-ui-buttonElement-framed oo-ui-labelElement oo-ui-buttonWidget"><a role="button" href="demos/ve/desktop-dist.html" tabindex="0" class="oo-ui-buttonElement-button"><span class="oo-ui-labelElement-label">Demo</span></a></div></a> |
| 40 | <div class="oo-ui-widget oo-ui-widget-enabled oo-ui-buttonElement oo-ui-buttonElement-framed oo-ui-labelElement oo-ui-buttonWidget"><a role="button" href="tests/" tabindex="0" class="oo-ui-buttonElement-button"><span class="oo-ui-labelElement-label">Test suite</span></a></div> |
| 41 | </article>' |
| 42 | echo "$html" > index.html |
| 43 | |
| 44 | # Disable Jekyll default settings for GitHub Pages |
| 45 | # as otherwise node_modules/qunitjs will not be published. |
| 46 | # https://help.github.com/articles/files-that-start-with-an-underscore-are-missing/ |
| 47 | # https://www.bennadel.com/blog/3181-including-node-modules.htm |
| 48 | touch .nojekyll |
| 49 | |
| 50 | git add index.html .nojekyll |
| 51 | git add -f node_modules/qunit dist/ |
| 52 | |
| 53 | git commit -m "Create gh-pages branch" |
| 54 | git push origin -f HEAD |