.gitlab-ci.yml 957 Bytes
Newer Older
1
default:
2 3 4 5 6
  retry: 2
  interruptible: true

stages:
  - test
7
  - build
8 9 10 11
  - deploy

lint:
  stage: test
12
  tags: [docker]
13
  image: node:12-buster
Guillaume Perréal's avatar
Guillaume Perréal committed
14 15
  variables:
    NPM_CONFIG_CACHE: "$CI_PROJECT_DIR/.npm"
16 17 18 19 20 21
  before_script:
    - node --version
    - npm --version
    - npm install
  script:
    - npm run lint
Guillaume Perréal's avatar
Guillaume Perréal committed
22
  cache:
23
    key: "$CI_COMMIT_REF_SLUG-$CI_JOB_NAME"
Guillaume Perréal's avatar
Guillaume Perréal committed
24 25
    paths:
      - "$NPM_CONFIG_CACHE"
26

27 28 29 30
docker:
  stage: build
  tags: [dind]
  variables:
Guillaume Perréal's avatar
Guillaume Perréal committed
31
    IMAGE: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
32 33
  before_script:
    - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
34 35 36 37 38
  script:
    - docker build --tag "$IMAGE" .
    - docker run --rm "$IMAGE" build
    - docker push "$IMAGE"

39 40
pages:
  stage: deploy
41 42
  image:
    name: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
43
    entrypoint: [""]
Guillaume Perréal's avatar
Guillaume Perréal committed
44 45
  rules:
    - if: $CI_COMMIT_BRANCH == "master"
46
  script:
47
    - prezbuilder build
48
  artifacts:
Guillaume Perréal's avatar
Guillaume Perréal committed
49 50
    name: pages
    paths:
51
      - public/