From accb4f6047ac5d8ff2907e32fbf9c1a68691aa83 Mon Sep 17 00:00:00 2001 From: Ben Alpert Date: Fri, 27 Mar 2015 20:15:20 -0700 Subject: [PATCH] Autobuild website on Travis from stable branch $REACT_WEBSITE_BRANCH in https://travis-ci.org/facebook/react/settings/env_vars now needs to point to the stable branch (currently 0.13-stable). I haven't tested the commit-and-push part of this but everything else works so I'm hopeful. --- .eslintignore | 2 ++ .gitignore | 2 ++ .travis.yml | 36 +++++++++++++++++++++++++++++++++--- docs/_config.yml | 1 + 4 files changed, 38 insertions(+), 3 deletions(-) diff --git a/.eslintignore b/.eslintignore index 862afe0fb99be..a74e51fcbb2a3 100644 --- a/.eslintignore +++ b/.eslintignore @@ -14,6 +14,8 @@ vendor/jasmine-jsreporter/ # But not in docs/_js/examples/* docs/_js/*.js docs/js/ +# gems +docs/vendor/bundle/ # This should be more like examples/**/thirdparty/** but # we should fix https://github.com/facebook/esprima/pull/85 first examples/ diff --git a/.gitignore b/.gitignore index fac6da38e4f26..f4dcfd6a95a9d 100644 --- a/.gitignore +++ b/.gitignore @@ -9,11 +9,13 @@ __benchmarks__ build/ .module-cache *.gem +docs/.bundle docs/code docs/_site docs/.sass-cache docs/js/* docs/downloads +docs/vendor/bundle examples/shared/*.js test/the-files-to-test.generated.js *.log* diff --git a/.travis.yml b/.travis.yml index 79c803fab7634..fbc7627d6de7b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,16 +5,43 @@ node_js: sudo: false cache: directories: + - docs/vendor/bundle - node_modules before_install: - | - git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.md$)|(^(docs|examples))/' || { + if [ "$TEST_TYPE" != build_website ] && \ + git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.md$)|(^(docs|examples))/' + then echo "Only docs were updated, stopping build process." exit - } + fi script: - | - grunt $TEST_TYPE + if [ "$TEST_TYPE" = build_website ]; then + if [ "$TRAVIS_BRANCH" = "$REACT_WEBSITE_BRANCH" ] && [ "$TRAVIS_PULL_REQUEST" = false ]; then + set -e + + GH_PAGES_DIR="$TRAVIS_BUILD_DIR"/../react-gh-pages + echo "machine github.com login reactjs-bot password $GITHUB_TOKEN" >~/.netrc + + git clone --branch gh-pages --depth=50 \ + https://reactjs-bot@github.com/facebook/react.git \ + $GH_PAGES_DIR + pushd docs + bundle install --jobs=3 --retry=3 --path=vendor/bundle + bundle exec rake release + cd $GH_PAGES_DIR + git status + if ! git diff-index --quiet HEAD --; then + git add -A . + git commit -m "Rebuild website" + git push + fi + popd + fi + else + grunt $TEST_TYPE + fi after_script: - | if [ "$TEST_TYPE" = test ] && [ "$SERVER" ]; then @@ -39,12 +66,15 @@ env: - TEST_TYPE=test - TEST_TYPE=jest - TEST_TYPE=lint + - TEST_TYPE=build_website - TEST_TYPE=test:webdriver:saucelabs:modern global: # SERVER - secure: qPvsJ46XzGrdIuPA70b55xQNGF8jcK7N1LN5CCQYYocXLa+fBrl+fTE77QvehOPhqwJXcj6kOxI+sY0KrVwV7gmq2XY2HZGWUSCxTN0SZlNIzqPA80Y7G/yOjA4PUt8LKgP+8tptyhTAY56qf+hgW8BoLiKOdztYF2p+3zXOLuA= # SECRET_TOKEN - secure: dkpPW+VnoqC/okhRdV90m36NcyBFhcwEKL3bNFExAwi0dXnFao8RoFlvnwiPlA23h2faROkMIetXlti6Aju08BgUFV+f9aL6vLyU7gUent4Nd3413zf2fwDtXIWIETg6uLnOpSykGKgCAT/hY3Q2oPLqOoY0OxfgnbqwxkxljrE= + # GITHUB_TOKEN + - secure: EHCyCSKMwKlLHNtcj9nmkRzmiiPE3aDGlPcnEyrDJeRI0SeN/iCXHXfFivR0vFq3vr+9naMBczAR2AEidtps5KbJrKqdZnjPFRbmfVtzWr/LlvVCub3u13Pub6TdKIVBTny1PuZ5X8GvdxMNVig89jGjvzhhWuQRaz3VhJnTra4= matrix: fast_finish: true allow_failures: diff --git a/docs/_config.yml b/docs/_config.yml index cd1d9e587a3fa..59616b71e88dc 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -25,6 +25,7 @@ exclude: - Gemfile.lock - README.md - Rakefile +- vendor/bundle markdown: redcarpet redcarpet: extensions: