.gitlab-ci.yml 999 Bytes
Newer Older
Athanasios's avatar
Athanasios committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
variables:
  EXPORT_DIR: "/var/www/html/pages"

stages:
  - test
  - deploy
  - cleanup
  
test-job:
  stage: test
  script:
    - echo "Testing files exist..."
    - test -f  public/index.html
    - test -f  public/main.js
    - test -f  public/settings.js
    - test -f  public/assets/css/style.css
Athanasios's avatar
Athanasios committed
17
    - test -f  public/assets/css/mobile.css
Athanasios's avatar
Athanasios committed
18
    - test -f  public/assets/images/header.jpg
Athanasios's avatar
Athanasios committed
19
    - test -f  public/assets/images/hft_logo.svg
Athanasios's avatar
Athanasios committed
20
21
22
23
24
25
26
27
    - test -f  public/home/index.html
    - echo "Test finished, all ok"
  only:
    - master
  
deploy-job:
  stage: deploy
  script:
Athanasios's avatar
Athanasios committed
28
    - if [ -d "$EXPORT_DIR/$CI_PROJECT_NAME" ]; then rm -r "$EXPORT_DIR/$CI_PROJECT_NAME"; fi
Athanasios's avatar
Athanasios committed
29
30
31
    - mkdir -p "$EXPORT_DIR/$CI_PROJECT_NAME"
    - cp -r public/* "$EXPORT_DIR/$CI_PROJECT_NAME"
  tags: 
Athanasios's avatar
Athanasios committed
32
    - docker
Athanasios's avatar
Athanasios committed
33
34
35
36
37
38
39
  only: 
    - master
  when: manual 

cleanup-job:
  stage: cleanup
  script:
Athanasios's avatar
Athanasios committed
40
    - if [ -d "$EXPORT_DIR/$CI_PROJECT_NAME" ]; then rm -r "$EXPORT_DIR/$CI_PROJECT_NAME"; fi
Athanasios's avatar
Athanasios committed
41
  tags: 
Athanasios's avatar
Athanasios committed
42
    - docker
Athanasios's avatar
Athanasios committed
43
  when: manual