mirror of
https://github.com/clockworkpi/wiki.clockworkpi.com.git
synced 2025-12-12 16:58:50 +01:00
CD/CI with GitLab-CI
This commit is contained in:
parent
4bbf35d9fc
commit
651a25bf39
59
.gitlab-ci.yml
Normal file
59
.gitlab-ci.yml
Normal file
@ -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
|
||||||
@ -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.
|
If you want to have this features on Github pages, you should push the generated site.
|
||||||
Any CI tool can help.
|
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
|
## 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.
|
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.
|
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:
|
References:
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user