# IGNORE THIS IS JUST FOR PURPOSE OF KEEPING IT SAFE SOMEWHERE

# Workflow for building and deploying html site to GitHub Pages
name: Generate html pages

on:
  # Runs on pushes targeting the default branch
  push:
    branches: ["main"]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
  contents: read
  pages: write
  id-token: write

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

jobs:
  # Build job
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: ["3.10"]
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.python-version }}
      - name: Install build dependencies
        run: |
          python -m pip install sphinx
          python -m pip install sphinx-autoapi
          python -m pip install pydata-sphinx-theme
      - name: Install locpix
        run: |
          pip install .
      - name: Make html
        run: |
          cd docs
          make templates
          make html
      - name: Upload artifact
        uses: actions/upload-pages-artifact@v1
        with:
          path: ./docs/build/html/

  # Deployment job
  deploy:
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    needs: build
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v1
