# add 'node_modules' to cache for speeding up builds
image: node:10

cache:
  paths:
    - node_modules/ # Node modules and dependencies

default:
  before_script:
    - npm install gitbook-cli -g # install gitbook
    - gitbook fetch 3.2.3 # fetch final stable version
    - gitbook install # add any requested plugins in book.json

test:
  stage: test
  script:
    - gitbook build . public # build to public path
  only:
    - branches # this job will affect every branch except 'master'
  except:
    - master
    
build:
  stage: build
  script:
    - npm install pandoc
    - python make_documents.py
  artifacts:
    paths:
      - Deliverable_4-8.md
      - Deliverable_4-9.md
      - statuspage.md
    expire_in: 3 weeks

# the 'pages' job will deploy and build your site to the 'public' path
pages:
  stage: deploy
  dependencies: 
    - build
  script:
    - gitbook build . public # build to public path
    - mv statuspage.md public
  artifacts:
    paths:
      - public
    expire_in: 3 years
  only:
    - master # this job will affect only the 'master' branch
