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