Skip to content

Commit d79cd5e

Browse files
committed
chore(docs): add hookdoc build workflow
Adds a GitHub Actions workflow to build and publish PHP hook documentation to GitHub Pages, replacing the need for a dedicated long-lived docs branch. - Workflow triggers on push to master, release publish, and manual dispatch - Adds jsdoc + wp-hookdoc (with patch) + patch-package - Adds build:docs script; does not modify main build pipeline - Ignores generated docs/ output (published to gh-pages)
1 parent 687f24a commit d79cd5e

7 files changed

Lines changed: 531 additions & 18 deletions

File tree

‎.github/workflows/build-docs.yml‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Build Docs
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
release:
8+
types: [published]
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
hookdocs:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '22'
25+
cache: 'npm'
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Build docs
31+
run: npm run build:docs
32+
33+
- name: Deploy to GitHub Pages
34+
uses: peaceiris/actions-gh-pages@v4
35+
with:
36+
github_token: ${{ secrets.GITHUB_TOKEN }}
37+
publish_dir: ./docs

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,6 @@ package/dist
6161

6262
# PHPStan result cache
6363
/.phpstan-cache/
64+
65+
# Generated docs (published to gh-pages by workflow)
66+
/docs/

‎.hookdoc/layout.tmpl‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title><?js= title ?> - Cloudinary Docs</title>
6+
7+
<script src="scripts/prettify/prettify.js"></script>
8+
<script src="scripts/prettify/lang-css.js"></script>
9+
<!--[if lt IE 9]>
10+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11+
<![endif]-->
12+
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
13+
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
14+
15+
<link
16+
href="https://fonts.googleapis.com/css?family=IBM+Plex+Mono|IBM+Plex+Sans:300,400|Playfair+Display:900&display=swap"
17+
rel="stylesheet">
18+
</head>
19+
20+
<body>
21+
22+
<div id="main">
23+
24+
<?js if (title !== 'Home') { ?>
25+
<h1 class="page-title"><?js= title ?></h1>
26+
<?js } ?>
27+
28+
<?js= content ?>
29+
</div>
30+
31+
<nav>
32+
<?js= this.nav ?>
33+
</nav>
34+
35+
<br class="clear">
36+
37+
<footer>
38+
<a href="https://cloudinary.com/" target="_blank" rel="noopener noreferrer">Cloudinary</a> |
39+
<a href="https://github.com/cloudinary/cloudinary_wordpress/" target="_blank" rel="noopener noreferrer">Cloudinary
40+
on GitHub</a>
41+
</footer>
42+
43+
<script> prettyPrint(); </script>
44+
<script src="scripts/linenumber.js"></script>
45+
</body>
46+
</html>

‎hookdoc-conf.json‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"opts": {
3+
"destination": "docs",
4+
"template": "node_modules/wp-hookdoc/template",
5+
"recurse": true,
6+
"readme": "./README.md"
7+
},
8+
"source": {
9+
"includePattern": ".+\\.(php|inc)?$"
10+
},
11+
"plugins": [
12+
"node_modules/wp-hookdoc/plugin"
13+
],
14+
"templates": {
15+
"default": {
16+
"layoutFile": ".hookdoc/layout.tmpl"
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)