name: Documentation

on:
  push:
    branches:
      - master
    tags:
      - "**"

concurrency:
  group: docs-deployment
  cancel-in-progress: false

jobs:
  documentation:
    name: Build and deploy
    if: github.repository == 'streamlink/streamlink'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
        with:
          fetch-depth: 300
      - name: Fetch tags
        run: ./.github/workflows/scripts/fetch-tags.sh
      - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
        with:
          python-version: "3.14"
      - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
      - name: Build
        run: uv run --frozen --group docs make --directory=docs html
      - name: Deploy
        env:
          DOCS_DEPLOY_TOKEN: ${{ secrets.DOCS_DEPLOY_TOKEN }}
        run: ./script/deploy-docs.sh
