.gitlab-ci.yml 1.42 KB
Newer Older
Yohan Jarosz's avatar
Yohan Jarosz committed
1
2
3
4
stages:
  - build
  - review
  
Yohan Jarosz's avatar
add ci  
Yohan Jarosz committed
5
6
7
8
9
10
11
12
13
Build for review:
    stage: build
    before_script:
      - bundle install --path ~/.gem && bundle update
    script:
      - 'echo "project_id: $CI_PROJECT_ID" > _config_review.yml'    
      - 'echo "project_namespace: $CI_PROJECT_PATH" >> _config_review.yml'
      - 'echo "mr_id: $CI_MERGE_REQUEST_ID" >> _config_review.yml'
      - 'echo "gitlab_host: https://git-r3lab.uni.lu" >> _config_review.yml'
Yohan Jarosz's avatar
d    
Yohan Jarosz committed
14
      - pwd
Yohan Jarosz's avatar
add ci  
Yohan Jarosz committed
15
16
17
18
19
20
21
22
23
24
25
26
      - bundle exec jekyll build -d public --config "_config.yml,_config_review.yml"
    artifacts:
      expire_in: 1 month
      paths:
        - public
    variables:
      JEKYLL_ENV: review
    except:
      - master
    tags:
      - review-app
  
Yohan Jarosz's avatar
Yohan Jarosz committed
27
Publish review:
Yohan Jarosz's avatar
add ci  
Yohan Jarosz committed
28
29
    stage: review
    script:
Yohan Jarosz's avatar
Yohan Jarosz committed
30
      - rsync -av --delete public /srv/nginx/pages/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/$CI_BUILD_REF_SLUG
Yohan Jarosz's avatar
add ci  
Yohan Jarosz committed
31
    environment:
Yohan Jarosz's avatar
Yohan Jarosz committed
32
33
      name: review $CI_BUILD_REF_NAME for $CI_PROJECT_PATH
      url: http://CI_BUILD_REF_SLUG-$CI_PROJECT_NAME-$CI_PROJECT_NAMESPACE.review.lcsb.uni.lu
Yohan Jarosz's avatar
Yohan Jarosz committed
34
      on_stop: "Un-publish review"
Yohan Jarosz's avatar
add ci  
Yohan Jarosz committed
35
36
37
    except:
      - master
    tags:
Yohan Jarosz's avatar
Yohan Jarosz committed
38
39
40
41
42
43
44
45
46
47
      - review-app

Un-publish review:
  stage: review
  script:
    - rm -rf /srv/nginx/pages/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/$CI_BUILD_REF_SLUG
  variables:
    GIT_STRATEGY: none
  when: manual
  environment:
Yohan Jarosz's avatar
Yohan Jarosz committed
48
    name: review $CI_BUILD_REF_NAME for $CI_PROJECT_PATH
Yohan Jarosz's avatar
Yohan Jarosz committed
49
50
    action: stop
  except:
Yohan Jarosz's avatar
Yohan Jarosz committed
51
    - master
Yohan Jarosz's avatar
Yohan Jarosz committed
52
53
54
  tags:
    - fp-review