|
1 | | -name: Lint and Style Checks |
| 1 | +name: Deploy Sphinx Docs to GitHub Pages |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | | - branches: [ "main", "master" ] |
6 | | - pull_request: |
7 | | - branches: [ "main", "master" ] |
| 5 | + branches: ["main"] |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +env: |
| 9 | + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: read |
| 13 | + pages: write |
| 14 | + id-token: write |
| 15 | + |
| 16 | +concurrency: |
| 17 | + group: "pages" |
| 18 | + cancel-in-progress: false |
8 | 19 |
|
9 | 20 | jobs: |
10 | | - lint: |
11 | | - name: Lint & Style Checks |
| 21 | + build: |
12 | 22 | runs-on: ubuntu-latest |
13 | | - strategy: |
14 | | - fail-fast: false |
15 | | - matrix: |
16 | | - language: [ 'python' ] |
17 | | - |
18 | 23 | steps: |
19 | | - - name: Checkout repository |
20 | | - uses: actions/checkout@v4 |
21 | | - |
22 | | - - name: Set up Python 3.10 |
23 | | - uses: actions/setup-python@v5 |
24 | | - with: |
25 | | - python-version: "3.10" |
| 24 | + - name: Checkout repository |
| 25 | + uses: actions/checkout@v4 |
| 26 | + |
| 27 | + - name: Set up Python |
| 28 | + uses: actions/setup-python@v5 |
| 29 | + with: |
| 30 | + python-version: '3.10' |
| 31 | + |
| 32 | + - name: Install dependencies |
| 33 | + run: | |
| 34 | + python -m pip install --upgrade pip |
| 35 | + pip install sphinx myst-parser sphinx-rtd-theme |
| 36 | + |
| 37 | + - name: Build HTML documentation |
| 38 | + run: | |
| 39 | + # 1. Build the documentation |
| 40 | + sphinx-build -b html docs/ docs/_build/html |
26 | 41 |
|
27 | | - - name: Cache pip dependencies |
28 | | - id: cache-pip |
29 | | - uses: actions/cache@v4 |
30 | | - with: |
31 | | - path: ~/.cache/pip |
32 | | - key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml', 'requirements.txt') }} |
33 | | - restore-keys: | |
34 | | - ${{ runner.os }}-pip- |
35 | | - |
36 | | - - name: Install System Dependencies (Tkinter) |
37 | | - run: | |
38 | | - sudo apt-get update |
39 | | - sudo apt-get install -y python3-tk |
40 | | - |
41 | | - - name: Install Python and Project Dependencies |
42 | | - run: | |
43 | | - python -m pip install --upgrade pip |
44 | | - pip install flake8 |
45 | | - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
46 | | - pip install -e . |
| 42 | + - name: Mirror Structure for Images |
| 43 | + run: | |
| 44 | + # This step makes "../pica/assets" work without changing your manual. |
| 45 | + # We create a folder structure inside the build output that matches |
| 46 | + # your relative paths. |
| 47 | + |
| 48 | + mkdir -p docs/_build/html/pica |
| 49 | + cp -r pica/assets docs/_build/html/pica/ |
| 50 | + |
| 51 | + # Copy publications folder |
| 52 | + cp -r publications/ docs/_build/html/publications/ || true |
| 53 | + |
| 54 | + # CRITICAL: Prevent GitHub from hiding folders starting with underscores |
| 55 | + touch docs/_build/html/.nojekyll |
| 56 | + |
| 57 | + - name: Upload GitHub Pages artifact |
| 58 | + uses: actions/upload-pages-artifact@v3 |
| 59 | + with: |
| 60 | + path: 'docs/_build/html' |
47 | 61 |
|
48 | | - - name: Run Style & Syntax Check (Flake8) |
49 | | - run: | |
50 | | - echo "STEP 1: Checking for critical syntax errors..." |
51 | | - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
52 | | - |
53 | | - echo "STEP 2: Checking for code style warnings..." |
54 | | - flake8 . --count --exit-zero --max-complexity=18 --max-line-length=127 --statistics |
| 62 | + deploy: |
| 63 | + environment: |
| 64 | + name: github-pages |
| 65 | + url: ${{ steps.deployment.outputs.page_url }} |
| 66 | + runs-on: ubuntu-latest |
| 67 | + needs: build |
| 68 | + steps: |
| 69 | + - name: Deploy to GitHub Pages |
| 70 | + id: deployment |
| 71 | + uses: actions/deploy-pages@v4 |
0 commit comments