From c039542e63d263410c5cbc2d9214f723fbbe9a30 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Fri, 20 Dec 2019 22:10:36 +0800 Subject: [PATCH] Allow the Pull Request to trigger a build. --- .travis.yml | 6 +----- _scripts/travis/cibuild.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 _scripts/travis/cibuild.sh diff --git a/.travis.yml b/.travis.yml index d8046c1..758927e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,11 +9,7 @@ install: - pip install ruamel.yaml script: - - >- - git clone https://${GH_TOKEN}@github.com/cotes2020/blog-builder.git - ../blog-builder --depth=1 -q - - cp -r ../blog-builder/framework/* . - - bash _cibuild.sh + - bash _scripts/travis/cibuild.sh branches: only: master diff --git a/_scripts/travis/cibuild.sh b/_scripts/travis/cibuild.sh new file mode 100644 index 0000000..1d61786 --- /dev/null +++ b/_scripts/travis/cibuild.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# Travis CI build jobs. +# +# © 2019 Cotes Chung +# Published under MIT License + +if [[ $TRAVIS_PULL_REQUEST = "false" ]]; then # triggered by author + + BUILDER=../blog-builder + + git clone https://${GH_TOKEN}@github.com/cotes2020/blog-builder.git \ + $BUILDER --depth=1 -q + + cp -r $BUILDER/framework/* . + bash _cibuild.sh + +else # triggered by Pull Request + + bundle install --path vendor/bundle --quiet + python _scripts/py/init_all.py + + build_cmd="JEKYLL_ENV=production bundle exec jekyll build" + + echo "\$ $build_cmd" + eval $build_cmd + +fi