name: Update Website

on:
  push:
    branches: master

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Generate SSH Key
        run: |
          mkdir -p ~/.ssh/
          echo "$SSH_PRIVATE_KEY" > private.key
          sudo chmod 600 private.key
          ssh-keyscan -H minicraisin > ~/.ssh/known_hosts
        env:
          SSH_PRIVATE_KEY: ${{secrets.SSH_PRIVATE_KEY}}
        shell: bash
      - name: Update Website
        run: |
          ssh -i private.key craisin@minicraisin "cd /home/craisin/data/personal-website && git pull"