blob: dc5f1a20dd540fe9e9777885a872fc98666751a8 [file] [log] [blame]
Thiago Macieira3cdb9c82017-12-27 23:29:33 -02001#!/bin/sh -ex
Thiago Macieirac9059d92018-03-13 15:07:54 -07002tuple="$TRAVIS_BRANCH${TRAVIS_TAG:+tag:$TRAVIS_TAG},$TRAVIS_PULL_REQUEST"
3case "$tuple" in
Thiago Macieira0170ebd2018-01-30 15:01:23 -08004 dev,false|master,false|tag:*)
Thiago Macieira3cdb9c82017-12-27 23:29:33 -02005 ;;
6 *)
7 exit 0
8 ;;
9esac
10V=`cut -f1-2 -d. <VERSION`
11git fetch origin gh-pages
12
13# Fail if the library sizes file isn't present
14test -r sizes
15
16# Run doxygen (maybe)
17if [ -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"
24else
25 git checkout -b gh-pages FETCH_HEAD
26 mkdir -p "$V"
27fi
28
29# Update the symlink for the branch name
30rm -f "./$TRAVIS_BRANCH"
31ln -s "$V" "$TRAVIS_BRANCH"
32git add "./$TRAVIS_BRANCH"
33
34# Update the library sizes file
35# (will fail if the release build failed)
36mkdir -p "library_sizes/$TRAVIS_BRANCH"
37mv 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"
40git add "library_sizes/$TRAVIS_BRANCH" "$V/library_sizes.txt"
Thiago Macieirac9059d92018-03-13 15:07:54 -070041git diff --cached -U0 "$V/library_sizes.txt"
Thiago Macieira3cdb9c82017-12-27 23:29:33 -020042
43# Commit everything
44if git commit -m "Update docs for $V (Travis build $TRAVIS_BUILD_NUMBER)
45
46Matching 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
52fi