.gitlab-ci.yml 1 KB
Newer Older
1
stages:
Matthieu Boileau's avatar
Matthieu Boileau committed
2
  - deps
3 4
  - build
  - deploy
Matthieu Boileau's avatar
Matthieu Boileau committed
5
  - post-deploy
6

Matthieu Boileau's avatar
Matthieu Boileau committed
7 8
deps:
  stage: deps
Matthieu Boileau's avatar
Matthieu Boileau committed
9
  tags:
Matthieu Boileau's avatar
Matthieu Boileau committed
10
    - pelican
Matthieu Boileau's avatar
Matthieu Boileau committed
11
  script:
12
    - echo "Building $CI_REGISTRY_IMAGE"
Matthieu Boileau's avatar
Matthieu Boileau committed
13 14
    - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
    - docker info
15 16
    - docker build --pull -t $CI_REGISTRY_IMAGE -f ./docker/Dockerfile .
    - docker push $CI_REGISTRY_IMAGE
17

18 19
build:
  stage: build
Matthieu Boileau's avatar
Matthieu Boileau committed
20
  image: $CI_REGISTRY_IMAGE
21
  tags:
Matthieu Boileau's avatar
Matthieu Boileau committed
22
    - docker
23
  script:
Matthieu Boileau's avatar
Matthieu Boileau committed
24
    - echo "Building website using docker image $CI_REGISTRY_IMAGE"
25
    - pelican -s publishconf.py --fatal errors
Matthieu Boileau's avatar
Matthieu Boileau committed
26 27
  artifacts:
    untracked: true
Matthieu Boileau's avatar
Matthieu Boileau committed
28
    expire_in: 1 hour
29

30 31
apache-dev:
  stage: deploy
Matthieu Boileau's avatar
Matthieu Boileau committed
32
  tags:
Matthieu Boileau's avatar
Matthieu Boileau committed
33
    - pelican
Matthieu Boileau's avatar
Matthieu Boileau committed
34 35
  variables:
    PUBLISH_DIR: "/var/www/calcul-dev/$CI_COMMIT_REF_NAME"
36
  only:
37
    - develop
38
    - /^dev-.*$/
Matthieu Boileau's avatar
Matthieu Boileau committed
39 40
  dependencies:
    - build
41
  script:
Matthieu Boileau's avatar
Matthieu Boileau committed
42
    - echo "Publishing to $PUBLISH_DIR"
Matthieu Boileau's avatar
Matthieu Boileau committed
43
    - rsync -av --delete --exclude 'attachments' output/ $PUBLISH_DIR/
Matthieu Boileau's avatar
Matthieu Boileau committed
44
    - rsync -av --delete content/attachments/ $PUBLISH_DIR/attachments/
45
    - chmod a+w $PUBLISH_DIR/job_offers/flood