Skip to content
Snippets Groups Projects
publish-module-api-doc.yaml 2.25 KiB
name: Publish module API documentation

on:
  push:
    branches: [master]
  pull_request:
    types: [opened, reopened, synchronize, labeled]
  workflow_dispatch:

concurrency:
  # Update of a developer branch cancels the previously scheduled workflow
  # run for this branch. However, the 'master' branch, release branch (1.10,
  # 2.8, etc.), and tag workflow runs are never canceled.
  #
  # We use a trick here: define the concurrency group as 'workflow run ID' +
  # 'workflow run attempt' because it is a unique combination for any run.
  # So it effectively discards grouping.
  #
  # Important: we cannot use `github.sha` as a unique identifier because
  # pushing a tag may cancel a run that works on a branch push event.
  group: ${{ (
    github.ref == 'refs/heads/master' ||
    github.ref == 'refs/heads/1.10' ||
    startsWith(github.ref, 'refs/heads/2.') ||
    startsWith(github.ref, 'refs/tags/')) &&
    format('{0}-{1}', github.run_id, github.run_attempt) ||
    format('{0}-{1}', github.workflow, github.ref) }}
  cancel-in-progress: true

jobs:
  publish-api-doc:
    # Run on push to the branch 'master' or on pull request if the 'full-ci'
    # label is set.
    if: github.repository == 'tarantool/tarantool' &&
        ( github.event_name != 'pull_request' ||
          contains(github.event.pull_request.labels.*.name, 'full-ci') )
    runs-on: ubuntu-latest
    steps:
      - uses: tarantool/actions/cleanup@master
      - uses: actions/checkout@v2.3.4
        with:
          fetch-depth: 0
          submodules: recursive

      - name: Setup Doxygen
        run: sudo apt install -y doxygen

      - name: Build module API documentation using Doxygen
        run: |
            cmake .
            make module_api
            sed -e "s%@PROJECT_.\+_DIR@/%%" Doxyfile.API.in > Doxyfile.API
            doxygen Doxyfile.API

      - name: Publish generated API documentation to GitHub Pages
        uses: JamesIves/github-pages-deploy-action@v4.4.0
        with:
          folder: doc/
        if: github.ref == 'refs/heads/master' &&
            github.event_name != 'pull_request'

      - name: Send VK Teams message on failure
        if: failure()
        uses: ./.github/actions/report-job-status
        with:
          bot-token: ${{ secrets.VKTEAMS_BOT_TOKEN }}