name: Deploy on: push: branches: [main] jobs: deploy: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Install pandoc and rsync run: sudo apt-get update && sudo apt-get install -y pandoc rsync - name: Generate HTML run: pandoc index.md -s -o index.html --css styles.css - name: Setup SSH key run: | mkdir -p ~/.ssh echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_ed25519 chmod 600 ~/.ssh/id_ed25519 - name: Deploy to server via rsync run: | rsync -avz --delete \ -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" \ --exclude='.git' \ index.html styles.css nginx.conf \ ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/usr/share/nginx/html/ - name: Reload nginx run: | ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \ ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} \ "nginx -s reload"