diff --git a/.travis.yml b/.travis.yml index 0392b10b..ae5ce542 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,22 +1,25 @@ -language: go -install: - - export HUGO_VERSION=0.20 - - export HUGO_PACKAGE=hugo_${HUGO_VERSION}_Linux-64bit - - curl -L https://github.com/spf13/hugo/releases/download/v$HUGO_VERSION/$HUGO_PACKAGE.tar.gz | tar xz - - mkdir $HOME/bin - - mv ./hugo_${HUGO_VERSION}_linux_amd64/hugo_${HUGO_VERSION}_linux_amd64 $HOME/bin/hugo -script: - - rm -rf docs - - cd DOCUMENTATION - - hugo +language: bash +sudo: required +services: + - docker + +env: + matrix: + - PHP_VERSION=56 + - PHP_VERSION=70 + - PHP_VERSION=71 + - HUGO_VERSION=0.20 + +script: ./scripts/build.sh deploy: provider: pages skip_cleanup: true - local_dir: ../docs + local_dir: docs github_token: $GITHUB_TOKEN on: branch: master + condition: -n "${HUGO_VERSION}" notifications: email: false diff --git a/_scripts/travis-build.sh b/_scripts/travis-build.sh new file mode 100755 index 00000000..d66343e3 --- /dev/null +++ b/_scripts/travis-build.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +if [ -n "${PHP_VERSION}" ]; then + cp env-example .env + docker-compose build + docker images +fi + +if [ -n "${HUGO_VERSION}" ]; then + HUGO_PACKAGE=hugo_${HUGO_VERSION}_Linux-64bit + HUGO_BIN=hugo_${HUGO_VERSION}_linux_amd64 + + # Download hugo binary + curl -L https://github.com/spf13/hugo/releases/download/v$HUGO_VERSION/$HUGO_PACKAGE.tar.gz | tar xz + mkdir $HOME/bin + mv ./${HUGO_BIN}/${HUGO_BIN} $HOME/bin/hugo + + # Remove existing docs + rm -r ./docs + + # Build docs + cd DOCUMENTATION + hugo +fi