# SPDX-FileCopyrightText: Copyright 2022 Arm Limited and/or its affiliates <open-source-office@arm.com>
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the License); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an AS IS BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Build documentation and pack
on:
  workflow_dispatch:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main
  release:
    types: [published]
jobs:
  pack:
    name: Generate pack
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Fetch tags
        if: ${{ github.event_name == 'release' }}
        run: |
          git fetch --tags --force

      - uses: Open-CMSIS-Pack/gen-pack-action@main
        with:
          doxygen-version: 1.9.2
          packchk-version: 1.3.95
          gen-doc-script: ./DoxyGen/gen_doc.sh
          check-links-script: |
            ./DoxyGen/check_links.sh \
              ./Documentation/html/index.html \
              ./DoxyGen
          doc-path: ./Documentation/html
          gen-pack-script: ./Scripts/gen_pack.sh
          gen-pack-output: ./output
          gh-pages-branch: gh-pages
