language: python
env:
   global:
       - secure: "pvQHCsdcIRjwNvsBrZxP8cZWEwug0+PLg1T8841ZLkMdCaO3YheqmxF1xGjAqty6hLppz6vX1LFEKmPjKurLL0/i+be6MhT8/ZikFpSan7TdNUqISxeFx31ls+QpuFKzCV7ZEx7C1ms8LPWEGmzMMN6bCtOBVtGznD9KKWZmLlA="
matrix:
    include:
        - os: linux
          python: 3.8
          env:
            - BUILD_DOCS=true

install:
  - pip install --upgrade -r requirements/docs.txt
  - pip install .

script:
  - set -ex
  - if [[ $BUILD_DOCS = true ]]; then
      cd docs;
      make html;
      cd ..;
      doctr deploy --deploy-repo xonsh/xonsh-docs dev;
      git checkout $(git describe --tags `git rev-list --tags --max-count=1`);
      git clean -fdx;
      pip install --upgrade --force-reinstall .;
      cd docs;
      make clean html;
      cd ..;
      doctr deploy --deploy-repo xonsh/xonsh-docs .;
    fi
