Skip to content

Commit

Permalink
MNT: Refresh gh-pages deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
kernc committed Jan 7, 2019
1 parent f3bdc3b commit 76deee9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ script:
- xvfb-run make test

after_success:
- if [ "$GH_PASSWORD" ] && [ $CC = "gcc" ]; then cd ..; .travis/man2html.sh; fi
- if [ "$TRAVIS_BRANCH" = "$TRAVIS_TAG" ] && [ $CC = "gcc" ]; then cd ..; .travis/deploy-gh-pages.sh; fi
21 changes: 21 additions & 0 deletions .travis/deploy-gh-pages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# If man had changed, rebuild its HTML and push to gh-pages

set -eu

[ "$GH_PASSWORD" ] || exit 12

head=$(git rev-parse HEAD)

git clone -b gh-pages "https://kernc:$GH_PASSWORD@github.com/$TRAVIS_REPO_SLUG.git" gh-pages
groff -wall -mandoc -Thtml doc/xsuspender.1 > gh-pages/xsuspender.1.html
cd gh-pages

ANALYTICS="<script>window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;ga('create','UA-43663477-3','auto');ga('require','cleanUrlTracker',{indexFilename:'index.html',trailingSlash:'add'});ga('require','outboundLinkTracker',{events:['click','auxclick','contextmenu']});ga('require', 'maxScrollTracker');ga('require', 'pageVisibilityTracker');ga('send', 'pageview');setTimeout(function(){ga('send','event','pageview','view')},15000);</script><script async src='https://www.google-analytics.com/analytics.js'></script><script async src='https://cdnjs.cloudflare.com/ajax/libs/autotrack/2.4.1/autotrack.js'></script>"
sed -i "s#</body>#$ANALYTICS</body>#i" xsuspender.1.html

git add *
git diff --staged --quiet && echo "$0: No changes to commit." && exit 0
git commit -am "CI: Update xsuspender.1.html from $TRAVIS_TAG ($head)"
git push
22 changes: 0 additions & 22 deletions .travis/man2html.sh

This file was deleted.

0 comments on commit 76deee9

Please sign in to comment.