name: Build Documentation using MkDocs
on:
  push:
    # Pattern matched against refs/tags
    tags:
      - '**'
  workflow_dispatch:
    tags:
      - '**'
jobs:
  build:
    name: Build and Deploy Documentation
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Master
        uses: actions/checkout@v6
      - name: Set up Python 3.9
        uses: actions/setup-python@v6
        with:
          python-version: '3.9'
      - name: Install Poetry
        uses: snok/install-poetry@v1.4
        with:
          version: 2.1.3
          virtualenvs-create: false
      - name: Install dependencies
        run: |
          poetry install --extras "all"
        env:
          POETRY_VIRTUALENVS_CREATE: false
      - name: Set env
        run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
      - name: Test
        run: |
          echo $RELEASE_VERSION
          echo ${{ env.RELEASE_VERSION }}
      - name: Deploy
        run: |
          mike deploy --push --update-aliases ${{ env.RELEASE_VERSION }} latest
