on:
  push:
    branches:
      - main
jobs:
  deploy:
    runs-on: docker
    container:
      image: forgejo.zenerdio.de/sebastian/c3space-website-ci:v0.2.0
    steps:
      - uses: actions/checkout@v3
      - uses: actions/cache@v3
        with:
          path: |
            virtenv
            cache
            output
          key: c3space-nikola-${{ github.ref_name }}
      - run: python3 -m venv virtenv
      - run: . virtenv/bin/activate; pip install -r requirements.txt
      - run: . virtenv/bin/activate; nikola build
      - run: echo "${{ secrets.DEPLOY_KEY }}" > id_rsa_deploy; chmod 600 id_rsa_deploy
      - run: rsync -gtr --chown=:www-data -e 'ssh -i id_rsa_deploy -o StrictHostKeyChecking=no' ./output/ rsync@zero-gravitas.zenerdio.de:/