Sync and Build Documentation #37
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
# .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 |