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