---
name: Build docset

on:
  push:
    tags: ["*"]
  workflow_dispatch:

env:
  PIP_DISABLE_PIP_VERSION_CHECK: 1
  PIP_NO_PYTHON_VERSION_WARNING: 1

permissions: {}

jobs:
  docset:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
        with:
          fetch-depth: 0  # get correct version
          persist-credentials: false
      - uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
        with:
          python-version: "3.12"

      - run: pip install tox

      - run: tox run -e docset
      - run: tar --exclude='.DS_Store' -cvzf structlog.tgz structlog.docset

      - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
        with:
          name: docset
          path: structlog.tgz
