Skip to content

Commit f383491

Browse files
committed
[DOC] Downloadable PDF Developer Guides
Signed-off-by: Arya Soni <aryasoni98@gmail.com>
1 parent 923ef9f commit f383491

File tree

6 files changed

+534
-0
lines changed

6 files changed

+534
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Generate PDFs
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
# Run weekly on Sundays at 2 AM UTC
7+
- cron: "0 2 * * 0"
8+
# Optional: Run after main branch updates (uncomment if desired)
9+
# push:
10+
# branches:
11+
# - main
12+
13+
jobs:
14+
generate-pdfs:
15+
if: github.repository == 'opensearch-project/documentation-website'
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Ruby
23+
uses: ruby/setup-ruby@v1
24+
with:
25+
ruby-version: '3.4.5'
26+
bundler-cache: true
27+
28+
- name: Build Jekyll site
29+
env:
30+
JEKYLL_ENV: production
31+
run: |
32+
bundle exec jekyll build --future
33+
34+
- name: Setup Node.js
35+
uses: actions/setup-node@v4
36+
with:
37+
node-version: '18'
38+
cache: 'npm'
39+
40+
- name: Install dependencies
41+
run: npm ci
42+
43+
- name: Generate PDFs
44+
run: |
45+
npm run generate-pdfs
46+
47+
- name: List generated PDFs
48+
run: |
49+
echo "Generated PDFs:"
50+
ls -lh pdfs/ || echo "No PDFs generated"
51+
52+
- name: Upload PDFs as artifacts
53+
uses: actions/upload-artifact@v4
54+
if: always()
55+
with:
56+
name: opensearch-documentation-pdfs
57+
path: pdfs/*.pdf
58+
retention-days: 30
59+
60+
# Optional: Create a GitHub release with PDFs
61+
# Uncomment and configure if you want to automatically create releases
62+
# - name: Create GitHub Release
63+
# if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
64+
# uses: softprops/action-gh-release@v1
65+
# with:
66+
# files: pdfs/*.pdf
67+
# tag_name: pdfs-${{ github.run_number }}
68+
# name: Documentation PDFs
69+
# body: |
70+
# Automatically generated PDF documentation for OpenSearch.
71+
# Generated on ${{ github.run_id }}
72+
# env:
73+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ Gemfile.lock
99
.jekyll-cache
1010
.project
1111
vendor/bundle
12+
node_modules
13+
pdfs
14+
package-lock.json

DEVELOPER_GUIDE.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,3 +300,78 @@ cd spec-insert
300300
bundle exec rake generate_dry_run_report
301301
```
302302
This will also generate a markdown (.md) file for each API with their rendered components in the `spec-insert/dry_run` folder. This allows you to preview the rendered components for all APIs without modifying the original documentation files. A report summarizing the errors found during the dry-run will be generated in the `spec-insert/dry_run_report.md` file.
303+
304+
## PDF Generation
305+
306+
The documentation website supports generating PDF versions of the developer guides and other documentation sections. This feature allows users to download complete documentation sets for offline use, easier searching, and integration with AI tools.
307+
308+
### Generating PDFs Locally
309+
310+
To generate PDFs locally:
311+
312+
1. **Install Node.js dependencies:**
313+
```shell
314+
npm install
315+
```
316+
317+
2. **Build the Jekyll site:**
318+
```shell
319+
bundle exec jekyll build
320+
```
321+
322+
3. **Generate PDFs:**
323+
```shell
324+
npm run generate-pdfs
325+
```
326+
327+
Or generate a PDF for a specific collection:
328+
```shell
329+
npm run generate-pdfs -- --collection developer-documentation
330+
```
331+
332+
The generated PDFs will be saved in the `pdfs/` directory.
333+
334+
### PDF Generation Configuration
335+
336+
PDF generation is configured in `pdf-config.json`. This file defines:
337+
- Which collections to convert to PDFs
338+
- PDF output settings (format, margins, headers, footers)
339+
- Base URL and output directory
340+
341+
You can customize the configuration by editing `pdf-config.json`.
342+
343+
### CI/CD Integration
344+
345+
PDF generation runs automatically in CI/CD through the [generate-pdfs.yml](.github/workflows/generate-pdfs.yml) GitHub Actions workflow. This workflow:
346+
347+
- Runs weekly on Sundays at 2 AM UTC
348+
- Can be triggered manually via `workflow_dispatch`
349+
- Builds the Jekyll site
350+
- Generates PDFs for all configured collections
351+
- Uploads PDFs as GitHub Actions artifacts
352+
353+
The workflow runs separately from the main Jekyll build to avoid adding to build time.
354+
355+
### Available PDFs
356+
357+
The following documentation sections are available as PDFs (as configured in `pdf-config.json`):
358+
359+
- OpenSearch Developer Guide
360+
- Getting Started Guide
361+
- API Reference
362+
- Install and Configure Guide
363+
- Cluster Tuning Guide
364+
- Security Guide
365+
- Query DSL Guide
366+
- Search Features Guide
367+
- Vector Search Guide
368+
- Machine Learning Guide
369+
370+
### Copyright and Usage
371+
372+
OpenSearch documentation is licensed under the Apache License 2.0, which allows you to:
373+
- Use the PDFs for personal or commercial purposes
374+
- Upload PDFs to AI tools (ChatGPT, NotebookLLM, etc.) for knowledge summarization
375+
- Share and distribute the PDFs
376+
377+
Proper attribution should be maintained when using the documentation.

0 commit comments

Comments
 (0)