name: Deploy TypeDocs to GitHub pages
on:
  push:
    branches:
      - master 
      - main
permissions:
  contents: write
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          ref: ${{ github.head_ref }}
          fetch-depth: 0
      - name: Generate static TypeDoc files
        uses: actions/setup-node@v4
        with:
          node-version: '20'
      - run: npm ci
      - run: npm run build-docs   

      - name: Init new repo in dist folder and commit generated files
        run: |
          cd docs
          git init
          git add -A
          git config --local user.email "action@github.com"
          git config --local user.name "GitHub Action"
          git commit -m "Deploy updated typedocs"

      - name: Push changes
        uses: ad-m/github-push-action@master
        with:
          branch: gh-pages
          force: true
          directory: ./docs








      
