bindcar 0.7.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@34e114876b0b11c390a56381ad16ebd13914f8d5 # 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@d0d51c638a90bffc2a1567fe7af112b37fe8854c # v1.3.7
        with:
          target: x86_64-unknown-linux-gnu

      - name: Set up Python
        uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
        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@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
        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@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
        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@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0

      - name: Upload artifact
        if: github.ref == 'refs/heads/main'
        uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
        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@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0