CD/CI with Travis-CI

This commit is contained in:
Alexis Hassler 2019-04-28 14:06:40 +02:00
parent 3efc244f97
commit 4bbf35d9fc
3 changed files with 46 additions and 1 deletions

33
.travis.yml Normal file
View File

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

View File

@ -18,6 +18,7 @@ exclude:
- Gemfile - Gemfile
- Gemfile.lock - Gemfile.lock
- img/brand - img/brand
- vendor # For CI cache
collections: collections:
wiki: wiki:

View File

@ -226,7 +226,18 @@ Any CI tool can help.
## TravisCI ## 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 # Examples