From 76deee9a3453f522b9b5dd25952c8ba23d83dad5 Mon Sep 17 00:00:00 2001 From: Kernc Date: Mon, 7 Jan 2019 17:00:25 +0100 Subject: [PATCH] MNT: Refresh gh-pages deploy script --- .travis.yml | 2 +- .travis/deploy-gh-pages.sh | 21 +++++++++++++++++++++ .travis/man2html.sh | 22 ---------------------- 3 files changed, 22 insertions(+), 23 deletions(-) create mode 100755 .travis/deploy-gh-pages.sh delete mode 100755 .travis/man2html.sh diff --git a/.travis.yml b/.travis.yml index 048b94e..d12486b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/.travis/deploy-gh-pages.sh b/.travis/deploy-gh-pages.sh new file mode 100755 index 0000000..609fffa --- /dev/null +++ b/.travis/deploy-gh-pages.sh @@ -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="" +sed -i "s##$ANALYTICS#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 diff --git a/.travis/man2html.sh b/.travis/man2html.sh deleted file mode 100755 index 2097467..0000000 --- a/.travis/man2html.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -# If man had changed, rebuild its HTML and push to gh-pages - -set -e - -[ "$TRAVIS" = true ] || exit 0 -[ "$TRAVIS_PULL_REQUEST" = false ] || exit 0 -[ "$GH_PASSWORD" ] || exit 12 - -parent=$(git show --pretty=raw HEAD | awk '/^parent /{ print $2; exit }') -head=$(git rev-parse HEAD) - -if ! git diff --name-only "$parent" "$head" | grep -Pq "doc/.*\.[1-8]$"; then - exit 0 -fi - -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 -git commit -m "CI: Update xsuspender.1.html from $head" -- xsuspender.1.html -git push