diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..67b5151 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,59 @@ +image: ruby:2.5 + +stages: + - build + - package + - deploy + +cache: + paths: + - vendor/ + +build: + stage: build + before_script: + - bundle install + script: + - echo "Build with Jekyll" + - bundle exec jekyll build --destination public + artifacts: + paths: + - public + expire_in: 10 minutes + +package: + stage: package + script: + - echo "Package downloadable wiki" + - tar -zcvf wiki.tar.gz public + artifacts: + paths: + - wiki.tar.gz + +upload: + stage: deploy + before_script: + - apt-get update + - apt install -y lftp + script: + - echo "Upload to $FTP_HOST" + # ftp and sftp are both supported in GitLab CI + - lftp ftp://$FTP_USERNAME:$FTP_PASSWORD@$FTP_HOST -e "set sftp:auto-confirm true; set ftp:use-utf8 false; mirror --reverse --verbose --delete public/ $FTP_DIR; bye" + only: + refs: + - master + variables: + - $FTP_PASSWORD + - $FTP_USERNAME + - $FTP_HOST + - $FTP_DIR + +pages: # Job name cannot be changed; see https://docs.gitlab.com/ee/user/project/pages/getting_started_part_four.html#job + stage: deploy + script: + - echo "Deploy to pages" + artifacts: + paths: + - public + only: + - master diff --git a/_wiki/Main.md b/_wiki/Main.md index e85984c..172a856 100644 --- a/_wiki/Main.md +++ b/_wiki/Main.md @@ -216,9 +216,21 @@ The wiki may be deployed on Github pages with the following contraints: If you want to have this features on Github pages, you should push the generated site. Any CI tool can help. -## Gitlab pages +## Gitlab pages / CI + +If your source code is hosted on Gitlab, you can deploy the wiki on Gitlab page. +The .gitlab-ci.yml provides a generic setup for that. +When you push on Gitlab, the file is be detected and a pipeline is run. +The wiki is then deployed on pages. + +> Note: the deployment may occur several minutes after the end of the build. + +With the provided configuration, Gitlab CI may also upload the site with SFTP. + +Reference: + +* [GitLab Pages](https://docs.gitlab.com/ee/user/project/pages/) -[TBD] ## Github actions @@ -232,7 +244,7 @@ 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. +With the provided configuration, Travis CI may also upload the site with SFTP. References: