Thiago Macieira | 3cdb9c8 | 2017-12-27 23:29:33 -0200 | [diff] [blame] | 1 | #!/bin/sh -ex |
Thiago Macieira | 0170ebd | 2018-01-30 15:01:23 -0800 | [diff] [blame] | 2 | case "$TRAVIS_BRANCH${TRAVIS_TAG+tag:$TRAVIS_TAG},$TRAVIS_PULL_REQUEST" in |
| 3 | dev,false|master,false|tag:*) |
Thiago Macieira | 3cdb9c8 | 2017-12-27 23:29:33 -0200 | [diff] [blame] | 4 | ;; |
| 5 | *) |
| 6 | exit 0 |
| 7 | ;; |
| 8 | esac |
| 9 | V=`cut -f1-2 -d. <VERSION` |
| 10 | git fetch origin gh-pages |
| 11 | |
| 12 | # Fail if the library sizes file isn't present |
| 13 | test -r sizes |
| 14 | |
| 15 | # Run doxygen (maybe) |
| 16 | if [ -n "${TRAVIS_TAG-$FORCE_DOCS}" ] && make -s docs 2>/dev/null; then |
| 17 | git checkout -b gh-pages FETCH_HEAD |
| 18 | if [ -d "$V" ]; then |
| 19 | mv "$V" "old-$V" |
| 20 | fi |
| 21 | mv doc/html "$V" |
| 22 | git add -A "$V" |
| 23 | else |
| 24 | git checkout -b gh-pages FETCH_HEAD |
| 25 | mkdir -p "$V" |
| 26 | fi |
| 27 | |
| 28 | # Update the symlink for the branch name |
| 29 | rm -f "./$TRAVIS_BRANCH" |
| 30 | ln -s "$V" "$TRAVIS_BRANCH" |
| 31 | git add "./$TRAVIS_BRANCH" |
| 32 | |
| 33 | # Update the library sizes file |
| 34 | # (will fail if the release build failed) |
| 35 | mkdir -p "library_sizes/$TRAVIS_BRANCH" |
| 36 | mv sizes "library_sizes/$TRAVIS_BRANCH/$QMAKESPEC" |
| 37 | (cd "library_sizes/$TRAVIS_BRANCH/"; |
| 38 | for f in *; do echo "$f:"; cat "$f" ; done) > "$V/library_sizes.txt" |
| 39 | git add "library_sizes/$TRAVIS_BRANCH" "$V/library_sizes.txt" |
| 40 | |
| 41 | # Commit everything |
| 42 | if git commit -m "Update docs for $V (Travis build $TRAVIS_BUILD_NUMBER) |
| 43 | |
| 44 | Matching commit $TRAVIS_COMMIT: |
| 45 | $TRAVIS_COMMIT_MESSAGE"; then |
| 46 | # We've made a commit, push it |
| 47 | set +x |
| 48 | url=`git config --get remote.origin.url | sed -e s,://github,://$GITHUB_AUTH@github,` |
| 49 | git push "$url" @:gh-pages |
| 50 | fi |