Skip to content

update docs format and hook into new website #2

update docs format and hook into new website

update docs format and hook into new website #2

Workflow file for this run

name: Build Docs
on:
push:
branches:
- main
paths:
- 'doc/**'
pull_request:
branches:
- main
paths:
- 'doc/**'
# Security: restrict GITHUB_TOKEN to least privilege.
# See: https://www.upwind.io/feed/hackerbot-claw-github-actions-pull-request-rce
permissions:
contents: read
jobs:
build:
name: build-docs
runs-on: ubuntu-latest
defaults:
run:
working-directory: doc
steps:
- name: Check out the repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v5
with:
python-version: 3.12
- name: Install doc dependencies
working-directory: .
run: |
pip install ".[doc]"
- name: Build
run: |
make html
- name: Upload built HTML
uses: actions/upload-artifact@v4
with:
name: docs-html
path: doc/_build/html/
sync-to-website:
name: sync-docs-to-website
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Download built HTML
uses: actions/download-artifact@v4
with:
name: docs-html
path: docs-html
- name: Check out website repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
with:
repository: sartography/SpiffWorks_WebsiteRea
token: ${{ secrets.SPIFFWORKS_WEBSITE_UPDATE_TOKEN }}
path: website-repo
- name: Sync built HTML to website
run: |
mkdir -p website-repo/static/docs/spiffworkflow/
rsync -av --delete docs-html/ website-repo/static/docs/spiffworkflow/
- name: Commit and push
working-directory: website-repo
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add static/docs/spiffworkflow/
git diff --staged --quiet && echo "No changes to sync." && exit 0
git commit -m "docs(spiffworkflow): sync from ${{ github.repository }}@${{ github.sha }}"
git push