before_script:
        # Setup SSH deploy keys
        - 'which ssh-agent || ( apt-get install -qq openssh-client )'
        - eval $(ssh-agent -s)
        - mkdir -p ~/.ssh
        - chmod 600 ~/.ssh
        - echo "$SSH_KEY" | tr -d '\r' > ~/.ssh/id_rsa
        - chmod 600 ~/.ssh/id_rsa
        - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
        #rsync
        #- apt-get update -qq && apt-get install -y --yes  --allow-unauthenticated -qq rsync
stages: 
    - build_release
#    - doxy_stage

build_release:
    stage: build_release
    image: python
    only:
        - main
    script:
        - ssh -t -t -p 90 $DEST_IP mkdir -p $DEST_PATH/$CI_PROJECT_NAME
        - scp -r -P 90 ./readme.md $DEST_IP:$DEST_PATH/$CI_PROJECT_NAME/readme.md
        
        #files for apollo
        - (if [ -f apollo.json ]; then scp -r -P 90 ./apollo.json $DEST_IP:$DEST_PATH/$CI_PROJECT_NAME/ ; fi);
        - (if [ -f changelog.md ]; then scp -r -P 90 ./changelog.md $DEST_IP:$DEST_PATH/$CI_PROJECT_NAME/ ; fi);
        - (if [ -f LICENSE ]; then scp -r -P 90 ./LICENSE $DEST_IP:$DEST_PATH/$CI_PROJECT_NAME/ ; fi);

#doxy_stage:
#    stage: doxy_stage
#    image: hrektts/doxygen
#    only:
#        - master
#    script:
#        #doxygen
#        - doxygen Doxyfile
#        #presun html do docs
#        - ssh -t -t -p 90 $DEST_IP mkdir -p $DEST_PATH/$CI_PROJECT_NAME/docs
#        - scp -r -P 90 ./html/* $DEST_IP:$DEST_PATH/$CI_PROJECT_NAME/docs

