# jobs belong to a stage. the jobs of a stage are run in parallel.
# stages are run in sequence.
# artifacts are attached to the jobs on success (downloadable from UI)
# cache is preserved between pipelines (and not meant for jobs)

default:
  image: cloudron/docs-ci@sha256:4a63ad48a6fbbd168828769b0d796b511d09d173ab5dd64368338997164aa4ab

variables:
  DOCS_SERVER: cryptowake.xyz

build-docs:
  stage: build
  script:
    - redoc-cli bundle cloudron_api_swagger.yaml --output "dist/api.html" --title "Docs" --disableGoogleFont=true
    - cd files && LC_ALL=C.UTF-8 LANG=C.UTF-8 mkdocs build --dirty --site-dir "../dist/"
  artifacts:
    paths:
      - dist/
    expire_in: 2 hours

deploy-docs:
  stage: deploy
  script:
    - surfer put --server ${DOCS_SERVER} --token ${CLOUDRON_DOCS_SURFER_TOKEN} --delete dist/* /
  only:
    - master

stages:
  - build
  - deploy
