travis for docker build and hugo site

This commit is contained in:
Mahmoud Zalt 2017-04-14 14:52:54 -04:00
commit 57ee5d96a4
2 changed files with 39 additions and 12 deletions

View File

@ -1,22 +1,25 @@
language: go language: bash
install: sudo: required
- export HUGO_VERSION=0.20 services:
- export HUGO_PACKAGE=hugo_${HUGO_VERSION}_Linux-64bit - docker
- curl -L https://github.com/spf13/hugo/releases/download/v$HUGO_VERSION/$HUGO_PACKAGE.tar.gz | tar xz
- mkdir $HOME/bin env:
- mv ./hugo_${HUGO_VERSION}_linux_amd64/hugo_${HUGO_VERSION}_linux_amd64 $HOME/bin/hugo matrix:
script: - PHP_VERSION=56
- rm -rf docs - PHP_VERSION=70
- cd DOCUMENTATION - PHP_VERSION=71
- hugo - HUGO_VERSION=0.20
script: ./scripts/build.sh
deploy: deploy:
provider: pages provider: pages
skip_cleanup: true skip_cleanup: true
local_dir: ../docs local_dir: docs
github_token: $GITHUB_TOKEN github_token: $GITHUB_TOKEN
on: on:
branch: master branch: master
condition: -n "${HUGO_VERSION}"
notifications: notifications:
email: false email: false

24
_scripts/travis-build.sh Executable file
View File

@ -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