bindcar 0.6.0

HTTP REST API for managing BIND9 zones via rndc
# Copyright (c) 2025 Erick Bourgeois, firestoned
# SPDX-License-Identifier: MIT

name: Documentation

on:
  push:
    branches:
      - main
    paths:
      - 'docs/**'
      - 'src/**/*.rs'
      - '.github/workflows/docs.yaml'
  pull_request:
    paths:
      - 'docs/**'
      - 'src/**/*.rs'
      - '.github/workflows/docs.yaml'
  workflow_dispatch:

permissions:
  contents: read
  pages: write
  id-token: write

# Allow one concurrent deployment
concurrency:
  group: "pages"
  cancel-in-progress: true

jobs:
  build:
    name: Build Documentation
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0  # Full history for git-revision-date-localized plugin

      - name: Setup Rust build environment
        uses: firestoned/github-actions/rust/setup-rust-build@v1.3.2
        with:
          target: x86_64-unknown-linux-gnu

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.11'

      - name: Install Poetry
        run: |
          curl -sSL https://install.python-poetry.org | python3 -
          echo "$HOME/.local/bin" >> "$GITHUB_PATH"

      - name: Configure Poetry
        run: |
          cd docs
          poetry config virtualenvs.in-project true

      - name: Cache Poetry dependencies
        uses: actions/cache@v4
        with:
          path: docs/.venv
          key: ${{ runner.os }}-poetry-${{ hashFiles('docs/poetry.lock') }}
          restore-keys: |
            ${{ runner.os }}-poetry-

      - name: Install documentation dependencies
        run: |
          cd docs
          poetry install --no-interaction --no-ansi

      - name: Cache cargo build
        uses: actions/cache@v4
        with:
          path: target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            ${{ runner.os }}-cargo-

      - name: Build documentation
        run: make docs

      - name: Check for broken links
        if: github.event_name == 'pull_request'
        continue-on-error: true
        run: |
          npm install -g linkinator
          linkinator docs/site/ --recurse --skip "rustdoc/.*" --verbosity error

      - name: Setup Pages
        if: github.ref == 'refs/heads/main'
        uses: actions/configure-pages@v4

      - name: Upload artifact
        if: github.ref == 'refs/heads/main'
        uses: actions/upload-pages-artifact@v3
        with:
          path: docs/site

  deploy:
    name: Deploy to GitHub Pages
    if: github.ref == 'refs/heads/main'
    needs: build
    runs-on: ubuntu-latest
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4