on:
  workflow_dispatch:  
  schedule:
    - cron: '37 * * * *'
  push:
    branches:
      - 'mai*'

jobs:
  test:
    runs-on: self-hosted
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      
      - name: Checkout oxidized
        uses: actions/checkout@v4
        with:
          repository: milka64/oxidized
          token: ${{ secrets.TOKEN }}
          path: oxidized
          ref: master

      - name: Checkout nginx config
        uses: actions/checkout@v4
        with:
          repository: milka64/nginx-config
          token: ${{ secrets.TOKEN }}
          path: nginx-config
          ref: main

      - name: "create devices directory"
        run: 'mkdir source/devices'

      - name: Parsing conf
        run: "cd parsers && python3.11 base.py"

      - name: Builing documentation
        run: 'make html'

      - name: deploy documentation
        run: 'sudo cp -r build/html/* /data/documentation/'

      - name: chown documentation
        run: 'sudo chown www-data:www-data -R /data/documentation/'