name: Build and Deploy MkDocs on: push: branches: - master jobs: build-deploy: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.x' - name: Install MkDocs run: | pip install --upgrade pip pip install mkdocs mkdocs-material pymdown-extensions mkdocs-material-extensions - name: Build site run: mkdocs build --clean - name: Setup SSH run: | mkdir -p ~/.ssh echo "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa ssh-keyscan -p ${{ secrets.DEPLOY_PORT || 22 }} ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts - name: Deploy with rsync run: | rsync -avz --delete \ --filter='P error/' \ --filter='P stats/' \ -e "ssh -p ${{ secrets.DEPLOY_PORT || 22 }}" \ site/ \ ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}:/var/www/dev.postalpoint.app/web