name: Restart Website Service

on:
  push:
    branches:
      - main

jobs:
  restart_service:
    runs-on: native

    steps:
      - name: Restart website service
        env:
          SSH_PRIVATE_KEY: ${{ secrets.WEBSITE_KEY }}
        run: |
          echo "$SSH_PRIVATE_KEY" > /tmp/private_key
          chmod 600 /tmp/private_key
          ssh -i /tmp/private_key -o StrictHostKeyChecking=no website-host-user@spoodythe.one -t 'sudo systemctl restart rebuild-website.service'
