From 4bbf35d9fcefadfc3c506ea070355835e36b0d04 Mon Sep 17 00:00:00 2001 From: Alexis Hassler Date: Sun, 28 Apr 2019 14:06:40 +0200 Subject: [PATCH] CD/CI with Travis-CI --- .travis.yml | 33 +++++++++++++++++++++++++++++++++ _config.yml | 1 + _wiki/Main.md | 13 ++++++++++++- 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..dd67bc3 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,33 @@ +language: ruby +cache: bundler +rvm: +- 2.5.3 + +before_script: bundle install +script: bundle exec jekyll build +exclude: [vendor] +sudo: false + +before_deploy: +- sudo apt-get update +- sudo apt install -y lftp +deploy: + # Deploy on a Github pages + - provider: pages + skip_cleanup: true + github_token: $GITHUB_TOKEN # Set in travis-ci.org dashboard + local_dir: _site + repo: jek4wik/jek4wik.github.io + target_branch: master + on: + branch: master + condition: -n "${GITHUB_TOKEN}" + # Upload with FTP + - provider: script + skip_cleanup: true + ## sftp is mandatory, ftp is not supported on Travis CI + ## see https://docs.travis-ci.com/user/common-build-problems/#ftpsmtpother-protocol-does-not-work + script: lftp sftp://$FTP_USERNAME:$FTP_PASSWORD@$FTP_HOST -e "mirror --reverse --verbose --delete _site/ $FTP_DIR; bye" + on: + branch: master + condition: -n "${FTP_PASSWORD}" diff --git a/_config.yml b/_config.yml index bdf0e1b..3320f41 100644 --- a/_config.yml +++ b/_config.yml @@ -18,6 +18,7 @@ exclude: - Gemfile - Gemfile.lock - img/brand + - vendor # For CI cache collections: wiki: diff --git a/_wiki/Main.md b/_wiki/Main.md index 783a203..e85984c 100644 --- a/_wiki/Main.md +++ b/_wiki/Main.md @@ -226,7 +226,18 @@ Any CI tool can help. ## TravisCI -[TBD] +[Travis CI](https://travis-ci.org/) can launch automatically the jekyll build and deploy the site. + +The examples and this page are built this way. +The [repository](https://github.com/jek4wik/jek4wik) provides a `.travis.yml` configuration file wich deploy the built site on Github Pages. +If want to use it, just change the `repo` and setup your build on Travis CI with the GITHUB_TOKEN environment variable. + +The Travis configuration may upload the site with SFTP. + +References: + +* [Travis CI - GitHub Pages Deployment](https://docs.travis-ci.com/user/deployment/pages/) +* [Travis CI - Script deployment](https://docs.travis-ci.com/user/deployment/script/) # Examples