image: clojure:lein-2.9.1-alpine

stages:
- build
- deploy
- pages

variables:
  LEIN_SNAPSHOTS_IN_RELEASE: "TRUE"

before_script:
  - echo "{:user {:repositories [[\"internal\" {:url \"${ARTIFACTORY_DEPLOY_REPOSITORY}\" :username :env/artifactory_user :password :env/artifactory_pw :sign-releases false :checksum :ignore}][\"internal_snapshot\" {:url \"${ARTIFACTORY_SNAPSHOT_REPOSITORY}\" :username :env/artifactory_user :password :env/artifactory_pw :sign-releases false :checksum :ignore}]] :mirrors {#\"clojars\" {:name \"lernmeister Artifactory\" :url \"https://leukipp.fh-muenster.de:8082/artifactory/list/Clojars/\"} \"central\" {:name \"lernmeister Artifactory Central\" :url \"https://leukipp.fh-muenster.de:8082/artifactory/list/Central/\"}}}}" > ~/.lein/profiles.clj

build:
  stage: build
  script:
    - lein clean
    - lein garden once
    - lein cljsbuild once hostedcards

deploy:
  stage: deploy
  script:
    - lein deploy internal
  only:
    - master

deployD:
  stage: deploy
  script:
    - lein deploy internal_snapshot
  only:
    - develop

pages:
  stage: pages
  script:
    - lein garden once
    - lein cljsbuild once hostedcards
    - mkdir public
    - cp -r resources/public/* public
  artifacts:
    paths:
      - public
  only:
    - master
