name: deploy to production

on: "push"
#    push:
#        branches:
#            - master

jobs:
    deploy:
        name: deploy
        runs-on: ubuntu-latest
        container:
            image: catthehacker/ubuntu:js-latest
            volumes:
                - /data:/data
        steps:
            - uses: actions/checkout@v3
              with:
                  fetch-depth: 0
                  lfs: true
                  submodules: true
            - run: |
                  git fetch --force --tags

            # setup node 18
            - name: setup node 18
              uses: actions/setup-node@v3
              with:
                  node-version: 18

            - name: build docs
              env:
                  FORCE_COLOR: "true"
              run: |
                  node --version
                  cd docs
                  yarn install
                  yarn docpress:build

            - uses: https://github.com/GuillaumeFalourd/setup-rsync@v1.1
            - name: deploy docs
              # only if branch is master
              if: github.ref == 'refs/heads/master'
              env:
                  RSYNC_HOST: ftp1.webmakers.de
                  RSYNC_PORT: 22222
                  RSYNC_USER: webmakers_tibi_docs_rsync_master
                  RSYNC_PASS: ${{ secrets.rsync_master }}
              run: |
                  cd docs

                  rsync -rlcgD --perms -i -u -v --stats --progress \
                  --delete \
                  -e "sshpass -p ${RSYNC_PASS} ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p ${RSYNC_PORT}" \
                  _docpress/ \
                  ${RSYNC_USER}@${RSYNC_HOST}:./ \
