CPP-AP: version 3.0.0 #127
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: documentation | |
| on: | |
| pull_request: | |
| branches: | |
| - '*' | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| build-doc: | |
| name: Build and validate documentation | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| - name: Set up python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: | | |
| sudo apt install doxygen -y | |
| pip install beautifulsoup4 | |
| - name: Validate the project version | |
| run: | | |
| VERSION=$(python3 scripts/check_version.py) | |
| echo "project version = $VERSION" | |
| - name: Run doxygen | |
| continue-on-error: false | |
| run: | | |
| doxygen Doxyfile | |
| python3 scripts/postprocess_doxyhtml.py ./documentation | |
| - name: Validate output | |
| run: test -d documentation && test -f documentation/index.html | |
| deploy-doc: | |
| name: Deploy documentation | |
| if: github.event_name == 'push' | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| - name: Set up python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: | | |
| sudo apt install doxygen -y | |
| pip install beautifulsoup4 | |
| - name: Extract and validate the project version | |
| continue-on-error: false | |
| run: | | |
| VERSION=$(python3 scripts/check_version.py) | |
| echo "project version = $VERSION" | |
| VERSION_TAG="${GITHUB_REF##*/}" | |
| echo "git version tag = $VERSION_TAG" | |
| if [[ "$VERSION_TAG" != "v$VERSION" ]]; then | |
| echo "Error: Tag missmatch: git version tag = $VERSION_TAG, project version: v$VERSION" | |
| exit 1 | |
| fi | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| - name: Run doxygen | |
| continue-on-error: false | |
| run: | | |
| doxygen Doxyfile | |
| python3 scripts/postprocess_doxyhtml.py ./documentation | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./documentation | |
| publish_branch: gh-pages | |
| destination_dir: ${{ env.VERSION }} | |
| - name: Deploy documantation as latest (setup) | |
| if: ${{ success() }} | |
| run: | | |
| CURRENT_VERSION="v${VERSION}" | |
| echo "Current version: $CURRENT_VERSION" | |
| git fetch --tags --force | |
| ALL_TAGS=$(git tag | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V) | |
| LATEST_TAG=$(echo "$ALL_TAGS" | tail -n 1) | |
| echo "Latest tag: $LATEST_TAG" | |
| if [ "$CURRENT_VERSION" = "$LATEST_TAG" ]; then | |
| echo "Current tag is the latest. Deploying to 'latest/'..." | |
| echo "DEPLOY_LATEST=true" >> $GITHUB_ENV | |
| else | |
| echo "Current tag is NOT the latest. Skipping deployment to 'latest/'." | |
| fi | |
| - name: Deploy to GitHub Pages as 'latest' | |
| if: env.DEPLOY_LATEST == 'true' | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./documentation | |
| publish_branch: gh-pages | |
| destination_dir: latest |