name: CD for Converting tm format to html

on:
  push:
    branches:
      - main

jobs:
  build:
    container: debian:bookworm
    runs-on: ubuntu-22.04
    steps:
      - name: Install dependencies
        run: apt-get update && apt-get install -y wget git
          
      - uses: actions/checkout@v3
        with:
          fetch-depth: 1

      - name: download release from mogan research repository
        run: |
          wget https://github.com/XmacsLabs/mogan/releases/download/v1.2.8/mogan-research-v1.2.8-debian12.deb -O /tmp/mogan-research.deb
          DEBIAN_FRONTEND=noninteractive apt install -y /tmp/mogan-research.deb

      - name: convert document to html format
        run: |
          /usr/bin/MoganResearch -headless -b CD/tm2html_CD.scm -x "(tm2html_CD)" -q
    
      # Deploy to local repo
      - name: Deploy
        uses: s0/git-publish-subdir-action@develop
        env:
          REPO: self
          BRANCH: gh-pages
          FOLDER: CD/html/planet
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}