Skip to content

Commit 103ed5e

Browse files
authored
Switch to phpDocumentor
1 parent 929083a commit 103ed5e

1 file changed

Lines changed: 56 additions & 26 deletions

File tree

Lines changed: 56 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,89 @@
1-
name: Generate API docs and publish to Github Pages
1+
# TODO:
2+
# - Theming for Moodle
3+
# - Document ALL code (below we exclude a bunch to try on a subset)
4+
5+
# Generate API docs and publish to GitHub Pages at phpdoc.moodledev.io
6+
#
7+
# How it works:
8+
# - Get Moodle code into .moodle
9+
# - Build docs into .docs
10+
# - Publish that to phpdoc.moodledev.io
11+
12+
name: Generate phpdoc.moodledev.io
213

314
env:
415
BRANCHLIST: "MOODLE_401_STABLE MOODLE_402_STABLE MOODLE_403_STABLE main"
516
VERSIONLIST: "4.1 4.2 4.3 main"
617

18+
# Allow GITHUB_TOKEN to deploy to GitHub Pages
19+
permissions:
20+
contents: read
21+
pages: write
22+
id-token: write
23+
724
on:
825
schedule:
9-
# Publish every Sunday at 1:30am
26+
# Publish every Sunday at 00:30 UTC
1027
- cron: '30 1 * * 0'
1128
workflow_dispatch:
1229

1330
jobs:
14-
deploy:
15-
runs-on: ubuntu-20.04
31+
build:
32+
runs-on: ubuntu-latest
1633
concurrency:
1734
group: ${{ github.workflow }}-${{ github.ref }}
35+
cancel-in-progress: true
1836
steps:
1937
- uses: actions/checkout@v4
2038
with:
2139
fetch-depth: 0
22-
show-progress: ''
40+
show-progress: false
2341

2442
- name: Checkout Moodle
2543
uses: actions/checkout@v4
2644
with:
2745
repository: moodle/moodle
2846
path: .moodle
29-
show-progress: ''
47+
show-progress: false
3048

3149
- name: Setup Node
3250
uses: actions/setup-node@v4
3351
with:
3452
node-version-file: '.moodle/.nvmrc'
3553

36-
- name: Build doxygen
37-
run: docker build --tag=doxygen phpdocs/doxygen
38-
39-
- name: Generate all API Documentation
40-
run: ./scripts/generate_api_docs.sh
54+
- name: Cache phpDocumentor build files
55+
id: phpdocumentor-cache
56+
uses: actions/cache@v4
57+
with:
58+
path: .phpdoc/cache
59+
key: ${{ runner.os }}-phpdocumentor-${{ github.sha }}
60+
restore-keys: |
61+
${{ runner.os }}-phpdocumentor-
4162
42-
- name: Copy Moodle Redirector
43-
run: |
44-
mkdir -p build/master
45-
cp redirect.html build/master/index.html
63+
# TODO: remove the ignores below, they speed up the runs for quick evaluation while we're setting this up
64+
- name: Build with phpDocumentor
65+
run: docker run --rm --volume "$(pwd):/data" phpdoc/phpdoc:3 -vv -d .moodle --target .docs --cache-folder .phpdoc/cache --template default --ignore .moodle/libs --ignore .moodle/admin --ignore .moodle/mod --ignore .moodle/blocks
4666

47-
- name: Deploy
48-
uses: peaceiris/actions-gh-pages@v3
67+
- name: Upload artifact to GitHub Pages
68+
uses: actions/upload-pages-artifact@v3
4969
with:
50-
github_token: ${{ secrets.GITHUB_TOKEN }}
51-
publish_dir: ./build
52-
cname: phpdoc.moodledev.io
70+
path: .docs
5371

54-
- name: Archive build ogs
55-
if: always()
56-
uses: actions/upload-artifact@v4
57-
with:
58-
name: Build logs
59-
path: logs
72+
deploy:
73+
needs: build
74+
75+
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
76+
permissions:
77+
pages: write # to deploy to Pages
78+
id-token: write # to verify the deployment originates from an appropriate source
79+
80+
# Deploy to the github-pages environment
81+
environment:
82+
name: github-pages
83+
url: ${{ steps.deployment.outputs.page_url }}
84+
85+
runs-on: ubuntu-latest
86+
steps:
87+
- name: Deploy to GitHub Pages
88+
id: deployment
89+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)