name: Deploy mkdocs

# Controls when the workflow will run
on:
  # Triggers the workflow on push request events in the main branch, but only for changes within mkdocs folder
  push:
    paths:
      - 'mkdocs/**'
    branches: [ master ]

  # Allows running this workflow manually from the Actions tab
  workflow_dispatch:

# Workflow jobs
jobs:
  build-and-deploy-docs:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Tasks that will be executed as part of the job
    steps:
      # Checks-out repository
      - uses: actions/checkout@v2

      # Installs mkdocs
      - name: install mkdocs
        run: pip install mkdocs

      # Installs material theme
      - name: install material theme
        run: pip install mkdocs-material

      # Builds docs
      - name: build
        run: cd mkdocs && mkdocs build

      # Deploys docs
      - name: deploy
        run: cd mkdocs && mkdocs gh-deploy --force
