name: Build documentation and pack
on:
  workflow_dispatch:
  pull_request:
  push:
    branches: [main]
  release:
    types: [published]

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  pack:
    name: Generate pack
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
          
      - name: Fetch tags
        run: |
          git fetch --tags --force

      - uses: Open-CMSIS-Pack/gen-pack-action@main
        with:
          doxygen-version: 1.9.6
          packchk-version: 1.4.1
          gen-doc-script: ./Documentation/Doxygen/gen_doc.sh
          doc-path: ./Documentation/html
          gen-pack-script: ./gen_pack.sh --no-preprocess
          gen-pack-output: ./output
          gh-pages-branch: gh-pages
