# This file is a template, and might need editing before it works on your project.
# Full project: https://gitlab.com/pages/plain-html

variables:
  JAVA_HOME: "/opt/jdk-12"
  EXPORT_PAGES_DIR: "/opt/tomcat9/webapps/ROOT/"

pages-master:    
  stage: deploy
  script:
    - echo $EXPORT_PAGES_DIR
    - mkdir .public
    - cp -r css .public
    - cp -r images .public
    - cp -r js .public
    - cp -r includes .public
    - cp *.html .public
    - mv .public public
    - cp -r public/* "$EXPORT_PAGES_DIR"
  artifacts:
    paths:
      - public
  only:
    - master

pages-devel:    
  stage: deploy
  script:
    - echo $EXPORT_PAGES_DIR
    - mkdir .public
    - cp -r css .public
    - cp -r images .public
    - cp -r js .public
    - cp -r includes .public
    - cp *.html .public
    - mv .public public
    - cd public
    - /opt/jdk-12/bin/jar -cvf ROOT.war *
    - curl --upload-file ROOT.war -u tomcat:$TOMCATPASS "http://193.196.52.30:8085/manager/text/deploy?path=/ROOT&update=true"
  artifacts:
    paths:
      - public
  only:
    - devel
