Documentation Deployment
The documentation workflow (documentation.yaml) handles building and deploying project documentation using dual trigger mechanisms to ensure reliable deployment after releases. This system solves critical GitHub Actions limitations for automated documentation updates during releases.
Overview
The documentation deployment system features:
- Dual Trigger Architecture: Handles both direct documentation changes and release-triggered updates
- Workflow Run Pattern: Solves GitHub Actions
GITHUB_TOKENcommit limitation - Intelligent Guard Jobs: Conditional deployment based on actual documentation changes
- Artifact-Based Communication: Reliable cross-workflow communication via artifacts
- GitHub Pages Integration: Automated deployment to GitHub Pages with Docusaurus
Advanced Trigger Architecture
The documentation workflow uses a sophisticated dual-trigger system to solve the GitHub Actions limitation where GITHUB_TOKEN commits don't trigger other workflows:
1. Direct Push Trigger (Traditional)
on:
push:
branches: ["master"]
paths:
- "docs/**"
- "*.md"
- "README*.md"
- ".github/workflows/documentation.yaml"
- ".github/workflows/release.yml"
- ".github/workflows/release-*.yml"
- ".github/workflows/rw_*.yaml"
- ".github/tag_and_release/**"
Purpose: Handles direct documentation changes pushed to master branch
Triggers On:
- Documentation file changes
- Workflow file changes that affect release processes
- Configuration changes that impact documentation
2. Workflow Run Trigger (Release Integration)
on:
workflow_run:
workflows: ["release"]
types: [completed]
branches: ["master"]
Purpose: Automatically triggers after release workflow completion to handle documentation updates made during version bumps
Workflow Run Pattern Implementation
Problem Solved
GitHub Actions Limitation: GitHub Actions doesn't trigger workflows on commits made by GITHUB_TOKEN (used in release workflows) to prevent infinite loops. This caused documentation workflow to never trigger after release workflow commits that updated documentation files.
Impact: Documentation would become stale after releases because version references in docs weren't being deployed.
Solution Architecture
Guard Job Implementation
The documentation workflow includes an intelligent guard job that provides conditional deployment logic:
Guard Job Logic
check_docs_changes:
if: github.event_name == 'workflow_run'
runs-on: ubuntu-latest
outputs:
should_deploy: ${{ steps.check_flag.outputs.should_deploy }}
steps:
- name: Download docs update flag from release workflow
uses: actions/download-artifact@v4
with:
name: release-docs-flag
run-id: ${{ github.event.workflow_run.id }}
- name: Check release workflow success and docs update flag
id: check_flag
run: |
# Verify release workflow succeeded
if [[ "${{ github.event.workflow_run.conclusion }}" != "success" ]]; then
echo "Release workflow did not succeed. Skipping documentation deployment."
echo "should_deploy=false" >> $GITHUB_OUTPUT
exit 0
fi
# Read docs update flag from artifact
DOCS_UPDATED=$(cat docs_updated.txt)
echo "Documentation update flag: $DOCS_UPDATED"
if [[ "$DOCS_UPDATED" == "true" ]]; then
echo "Documentation was updated during release. Proceeding with deployment."
echo "should_deploy=true" >> $GITHUB_OUTPUT
else
echo "No documentation updates detected. Skipping deployment."
echo "should_deploy=false" >> $GITHUB_OUTPUT
fi
Guard Job Functions
- Downloads Release Artifacts: Retrieves the
DOCS_UPDATEDflag from the completed release workflow - Verifies Release Success: Ensures the release workflow completed successfully
- Evaluates Update Flag: Checks if documentation files were actually updated during the release
- Controls Deployment: Only proceeds with documentation deployment if docs were updated
Conditional Deployment Logic
The main deployment job runs conditionally based on the trigger type:
deploy_documentation:
# Run for direct push OR workflow_run with docs changes
if: |
github.event_name == 'push' ||
(github.event_name == 'workflow_run' && needs.check_docs_changes.outputs.should_deploy == 'true')
needs: [check_docs_changes]
runs-on: ubuntu-latest
Deployment Conditions:
- Direct Push Events: Always deploy (traditional behavior)
- Workflow Run Events: Only deploy if guard job approves (
should_deploy=true)
Release Workflow Integration
The release workflow (release.yml) has been enhanced to support this pattern through the DOCS_UPDATED flag system.
DOCS_UPDATED Flag Generation
During the version bump process, the release workflow:
1. Tracks Documentation Updates
Uses existing DOCS_UPDATED flag from bump step logic that already determines if documentation files need updating:
# Version bump logic already sets DOCS_UPDATED flag
DOCS_UPDATED=false
# Check if documentation files that reference versions need updating
if [[ -f "docs/contents/development/ci-cd/index.mdx" ]] ||
[[ -f "docs/contents/document/installation.md" ]] ||
[[ -f "docs/contents/document/README.md" ]]; then
DOCS_UPDATED=true
fi