diff --git a/.travis.yml b/.travis.yml index bd4e3e1dd1..94c428591b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -123,7 +123,8 @@ script: ../src || exit - make -j2 || exit - if [[ $TEST != OFF ]]; then yes "A" | ctest -j2 --output-on-failure; fi - - if [[ $UPLOAD == ON ]]; then cpack; make package; fi + - if [[ $UPLOAD == ON ]]; then cpack; fi + - if [[ $UPLOAD == ON && $GH_TOKEN && $TRAVIS_PULL_REQUEST == false && $TRAVIS_BRANCH == master ]]; then bash script/deploy_gh_pages.sh; fi - if [[ $TEST_LEANPKG_REGISTRY == ON ]]; then ../script/test_registry.py; fi - cd .. @@ -139,12 +140,11 @@ notifications: deploy: provider: releases - api_key: - secure: NeTKs0tb0hM9yC1lJyc7Y8ev1rfEe9tpY8bS20hUivNKcX8S0HjJh/xtx/3LgrhcqVP0xKuDPE0YNQk3E9SO1ni2ESjIFIVXI/hpDLNjxjfaeW7rcpYcc7dy7ynEP23HnAOMr4PMHs0T/ATsJHKyDXTUi4yrQToBBTQUFvCKgo8= + api_key: $GH_TOKEN file: $TARGET skip_cleanup: true overwrite: true on: - condition: $UPLOAD = ON + condition: $UPLOAD = ON && $GH_TOKEN repo: leanprover/lean tags: true diff --git a/.travis.yml.in b/.travis.yml.in index 51ddd848cc..8e189f3c7d 100644 --- a/.travis.yml.in +++ b/.travis.yml.in @@ -123,7 +123,8 @@ script: ../src || exit - make -j2 || exit - if [[ $TEST != OFF ]]; then yes "A" | ctest -j2 --output-on-failure; fi - - if [[ $UPLOAD == ON ]]; then cpack; make package; fi + - if [[ $UPLOAD == ON ]]; then cpack; fi + - if [[ $UPLOAD == ON && $GH_TOKEN && $TRAVIS_PULL_REQUEST == false && $TRAVIS_BRANCH == master ]]; then bash script/deploy_gh_pages.sh; fi - if [[ $TEST_LEANPKG_REGISTRY == ON ]]; then ../script/test_registry.py; fi - cd .. @@ -139,12 +140,11 @@ notifications: deploy: provider: releases - api_key: - secure: NeTKs0tb0hM9yC1lJyc7Y8ev1rfEe9tpY8bS20hUivNKcX8S0HjJh/xtx/3LgrhcqVP0xKuDPE0YNQk3E9SO1ni2ESjIFIVXI/hpDLNjxjfaeW7rcpYcc7dy7ynEP23HnAOMr4PMHs0T/ATsJHKyDXTUi4yrQToBBTQUFvCKgo8= + api_key: $GH_TOKEN file: $TARGET skip_cleanup: true overwrite: true on: - condition: $UPLOAD = ON + condition: $UPLOAD = ON && $GH_TOKEN repo: leanprover/lean tags: true diff --git a/script/deploy_gh_pages.sh b/script/deploy_gh_pages.sh new file mode 100644 index 0000000000..ad4ce9403d --- /dev/null +++ b/script/deploy_gh_pages.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# inspired by https://github.com/steveklabnik/automatically_update_github_pages_with_travis_example + +set -eu + +rev=$(git rev-parse --short HEAD) + + +git clone -b gh-pages "https://$GH_TOKEN@github.com/$TRAVIS_REPO_SLUG.git" gh-pages +cd gh-pages + +# "build/lean-3.2.0-linux.tar.gz" ~> "build/lean-nightly-linux.tar.gz" +NIGHTLY_TARGET=${TARGET/-*-/-nightly-} +mkdir -p build +ln ../$TARGET $NIGHTLY_TARGET + +git config user.name "Bot Botson" +git config user.email "bot@bot.bot" + +git add -A . +git commit -am "nightly build at ${rev}" +git push -fq