Python API documentation update pull request (main) #2395
This file contains 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: Docs | |
on: [pull_request, workflow_dispatch] | |
jobs: | |
docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
pip install sphinx==8.1.3 sphinx_rtd_theme==3.0.0 sphinx-favicon myst_parser==4.0.0 sphinx_sitemap sphinxcontrib.newsfeed | |
- name: Sphinx build | |
run: | | |
sphinx-build -W --keep-going doc _build | |
if [ $? -ne 0 ]; then | |
echo -e "\033[1;31mSphinx build FAILED\033[0m\n" | |
exit 1 | |
else | |
echo -e "\033[1;32mSphinx build PASSED\033[0m\n" | |
fi | |
- name: Insert RSS link into news page HTML header | |
run: | | |
sed -i 's|</head>| <link rel="alternate" type="application/rss+xml" title="ZEISS INSPECT Add-on Python API News Feed" href="../index.rss" />\n</head>|' _build/news/news.html | |
- name: Set branch name | |
id: branch | |
run: echo "SUBDIR_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV | |
- name: Replace main by 2025 in canonical link | |
run: | | |
find . -type f -name "*.html" -exec sed -i 's@<link rel="canonical" href="https://zeissiqs\.github\.io/zeiss-inspect-addon-api/main/@<link rel="canonical" href="https://zeissiqs\.github\.io/zeiss-inspect-addon-api/2025/@' {} + | |
- name: Deploy | |
if: ${{ github.event_name != 'pull_request' }} | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: _build/ | |
destination_dir: ${{ env.SUBDIR_NAME }} | |
full_commit_message: Deploy documentation of '${{ env.SUBDIR_NAME }}' to GitHub Pages | |
- name: Checkout gh-pages | |
uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
# NOTE: | |
# Targets behind login page cannot be checked!!! | |
# * software-store.zeiss.com/products/apps/ | |
# * techguide.zeiss.com | |
# * training.gom.com | |
- name: Linkcheck | |
id: lychee | |
if: ${{ env.SUBDIR_NAME != 'merge' }} | |
uses: lycheeverse/lychee-action@v2 | |
with: | |
args: --base . --verbose --no-progress '${{ env.SUBDIR_NAME }}/**/*.html' |