Skip to content

Commit 1a071c7

Browse files
committed
ci: adopt shared docs generation workflow
1 parent 7368448 commit 1a071c7

2 files changed

Lines changed: 7 additions & 131 deletions

File tree

.github/workflows/generate-docs.yml

Lines changed: 4 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -12,136 +12,9 @@ on:
1212
permissions:
1313
contents: write
1414

15-
concurrency:
16-
group: generate-docs
17-
cancel-in-progress: true
18-
1915
jobs:
2016
generate-docs:
21-
runs-on: ubuntu-latest
22-
23-
steps:
24-
- name: Checkout
25-
uses: actions/checkout@v4
26-
27-
- name: Install Pandoc
28-
run: |
29-
PANDOC_VER=3.6.3
30-
wget -q "https://github.com/jgm/pandoc/releases/download/${PANDOC_VER}/pandoc-${PANDOC_VER}-1-amd64.deb"
31-
sudo dpkg -i "pandoc-${PANDOC_VER}-1-amd64.deb"
32-
rm "pandoc-${PANDOC_VER}-1-amd64.deb"
33-
34-
- name: Install LaTeX and fonts
35-
run: |
36-
sudo apt-get update -qq
37-
sudo apt-get install -y \
38-
texlive-xetex \
39-
texlive-latex-recommended \
40-
texlive-fonts-recommended \
41-
texlive-fonts-extra \
42-
texlive-latex-extra \
43-
lmodern \
44-
fonts-noto-core \
45-
fonts-noto-extra \
46-
epubcheck \
47-
poppler-utils
48-
49-
- name: Install eisvogel template
50-
run: |
51-
mkdir -p ~/.pandoc/templates
52-
TMPDIR_EIS=$(mktemp -d)
53-
curl -sL "https://github.com/Wandmalfarbe/pandoc-latex-template/releases/latest/download/Eisvogel.tar.gz" \
54-
| tar -xz -C "$TMPDIR_EIS"
55-
find "$TMPDIR_EIS" -name "*.latex" -exec cp {} ~/.pandoc/templates/ \;
56-
rm -rf "$TMPDIR_EIS"
57-
ls ~/.pandoc/templates/
58-
59-
- name: Bootstrap reference.docx
60-
run: |
61-
mkdir -p .github/pandoc
62-
if [ ! -f .github/pandoc/reference.docx ]; then
63-
pandoc --print-default-data-file reference.docx > .github/pandoc/reference.docx
64-
echo "Created default reference.docx (customise via Word to restyle DOCX output)"
65-
fi
66-
67-
- name: Update date in frontmatter
68-
run: |
69-
md_file="WordPress-Security-Hardening-Guide.md"
70-
today=$(date '+%B %-d, %Y')
71-
if head -1 "$md_file" | grep -q '^---$'; then
72-
sed -i "s/^date: .*/date: \"$today\"/" "$md_file"
73-
echo " Updated date -> $today in $md_file"
74-
fi
75-
76-
- name: Convert primary document
77-
run: |
78-
md_file="WordPress-Security-Hardening-Guide.md"
79-
base="${md_file%.md}"
80-
docx_file="${base}.docx"
81-
82-
# Read version from YAML frontmatter
83-
version=$(sed -n '/^---$/,/^---$/{ s/^version: *"\{0,1\}\([^"]*\)"\{0,1\}/\1/p }' "$md_file")
84-
display_date="Version ${version} — $(date '+%B %-d, %Y')"
85-
86-
echo "▶ $md_file (${display_date})"
87-
88-
# 1) Markdown -> DOCX (intermediary template layer)
89-
pandoc "$md_file" \
90-
--reference-doc=".github/pandoc/reference.docx" \
91-
--toc --toc-depth=3 \
92-
-o "$docx_file"
93-
echo " ✓ DOCX"
94-
95-
# 2) DOCX -> PDF
96-
pandoc "$docx_file" \
97-
--from docx \
98-
--template eisvogel \
99-
--pdf-engine xelatex \
100-
--defaults ".github/pandoc/pdf-defaults.yaml" \
101-
--metadata "date=${display_date}" \
102-
--toc --toc-depth=3 \
103-
-o "${base}.pdf"
104-
echo " ✓ PDF"
105-
106-
# 3) DOCX -> EPUB
107-
pandoc "$docx_file" \
108-
--from docx \
109-
--toc --toc-depth=3 \
110-
--epub-title-page=false \
111-
--metadata "lang=en-US" \
112-
-o "${base}.epub"
113-
echo " ✓ EPUB"
114-
115-
- name: Validate generated outputs
116-
run: |
117-
md_file="WordPress-Security-Hardening-Guide.md"
118-
base="${md_file%.md}"
119-
120-
for artifact in "${base}.docx" "${base}.pdf" "${base}.epub"; do
121-
if [ ! -s "$artifact" ]; then
122-
echo "Missing or empty artifact: $artifact"
123-
exit 1
124-
fi
125-
done
126-
127-
echo "Running EPUB validation..."
128-
epubcheck "${base}.epub"
129-
130-
echo "Running PDF validation..."
131-
pdfinfo_out=$(pdfinfo "${base}.pdf")
132-
echo "$pdfinfo_out"
133-
echo "$pdfinfo_out" | grep -Eq '^Pages:[[:space:]]+[1-9][0-9]*$'
134-
echo "$pdfinfo_out" | grep -Eq '^PDF version:[[:space:]]+[0-9.]+$'
135-
136-
- name: Commit generated documents
137-
run: |
138-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
139-
git config user.name "github-actions[bot]"
140-
git add WordPress-Security-Hardening-Guide.md WordPress-Security-Hardening-Guide.pdf WordPress-Security-Hardening-Guide.docx WordPress-Security-Hardening-Guide.epub .github/pandoc/reference.docx 2>/dev/null || true
141-
if ! git diff --staged --quiet; then
142-
git commit -m "docs: regenerate PDF, Word, and EPUB documents [skip ci]"
143-
git pull --rebase origin main
144-
git push
145-
else
146-
echo "No changes to commit"
147-
fi
17+
uses: dknauss/ai-assisted-docs/.github/workflows/reusable-generate-docs.yml@main
18+
with:
19+
primary_markdown: WordPress-Security-Hardening-Guide.md
20+
secrets: inherit

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ All notable changes to the WordPress Security Hardening Guide.
44

55
## Unreleased
66

7+
### Changed
8+
- Replaced the repo-local document-generation workflow with a caller to the shared reusable workflow in `ai-assisted-docs`, keeping the primary markdown source and generated artifact names unchanged.
9+
710
### Added
811
- `CHANGELOG.md` — this file.
912
- `docs/current-metrics.md` — architectural fact counts with verification commands.

0 commit comments

Comments
 (0)