Skip to content

Sync and Build Documentation #43

Sync and Build Documentation

Sync and Build Documentation #43

Workflow file for this run

# .github/workflows/sync-docs.yml
name: Sync and Build Documentation
on:
schedule:
- cron: '0 6 * * *' # Daily at 6 AM UTC
workflow_dispatch:
repository_dispatch:
types: [docs-updated] # Could be used as a on-push trigger, not sure
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout GitHub Pages repo
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Clone documentation repository
run: |
git clone https://github.com/multi-os-engine/doc.git temp-docs
- name: Install Sphinx and dependencies
run: |
python -m pip install --upgrade pip
pip install sphinx sphinx-rtd-theme
- name: Build documentation
run: |
cd temp-docs
make dirhtml
cd ..
- name: Deploy docs
run: |
rm -rf docs/
mkdir -p docs/
cp -r temp-docs/build/dirhtml/* docs/
rm -rf temp-docs/
- name: Commit and push changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add docs/
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "Update documentation $(date '+%Y-%m-%d %H:%M:%S')"
git push
fi