Skip to content

Commit 6af924c

Browse files
committed
Generate docs with AsciiDoctor and deploy
Add Maven POM with AsciiDoctor Maven Plugin (v3.2.0) to generate HTML documentation from all README.adoc files to target/generated-docs. Documentation includes images and maintains directory structure. Add Maven Wrapper (3.9.11) for consistent Maven version across environments and CI/CD pipelines. Add new 'docs' workflow job that: - Runs on Linux with Java 17 after successful build - Generates HTML docs using './mvnw verify' - Validates HTML with htmlSanityCheck plugin - Deploys preview to Netlify for PRs and branches - Deploys to GitHub Pages for main branch - Creates index.html from README.html as landing page Update .gitignore to exclude generated HTML files and target directory. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Introduced in the course of support-and-care/maven-support-and-care#137
1 parent 974654b commit 6af924c

File tree

6 files changed

+647
-3
lines changed

6 files changed

+647
-3
lines changed

.github/workflows/build.yml

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,4 +164,78 @@ jobs:
164164
shell: bash
165165
run: |
166166
echo "Environment:"
167-
env | sort
167+
env | sort
168+
169+
docs:
170+
name: Generate and Deploy Documentation
171+
runs-on: ubuntu-latest
172+
needs: build
173+
if: success()
174+
175+
permissions:
176+
contents: read
177+
pull-requests: write
178+
pages: write
179+
id-token: write
180+
181+
steps:
182+
- name: Checkout repository
183+
uses: actions/checkout@v4
184+
185+
- name: Set up JDK 17
186+
uses: actions/setup-java@v4
187+
with:
188+
distribution: 'temurin'
189+
java-version: '17'
190+
191+
- name: Generate documentation
192+
run: ./mvnw verify
193+
194+
- name: Create index.html from README.html
195+
run: cp target/generated-docs/README.html target/generated-docs/index.html
196+
197+
- name: Upload documentation artifact
198+
uses: actions/upload-artifact@v4
199+
with:
200+
name: generated-docs
201+
path: target/generated-docs
202+
retention-days: 30
203+
204+
- name: Deploy to Netlify (Preview)
205+
if: github.event_name == 'pull_request'
206+
uses: nwtgck/actions-netlify@v3
207+
with:
208+
publish-dir: './target/generated-docs'
209+
production-deploy: false
210+
github-token: ${{ secrets.GITHUB_TOKEN }}
211+
deploy-message: "Deploy from GitHub Actions - PR #${{ github.event.pull_request.number }}"
212+
enable-pull-request-comment: true
213+
enable-commit-comment: false
214+
overwrites-pull-request-comment: true
215+
env:
216+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
217+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
218+
219+
- name: Deploy to Netlify (Branch Preview)
220+
if: github.event_name == 'push' && github.ref != 'refs/heads/main'
221+
uses: nwtgck/actions-netlify@v3
222+
with:
223+
publish-dir: './target/generated-docs'
224+
production-deploy: false
225+
github-token: ${{ secrets.GITHUB_TOKEN }}
226+
deploy-message: "Deploy from GitHub Actions - branch ${{ github.ref_name }}"
227+
alias: ${{ github.ref_name }}
228+
env:
229+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
230+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
231+
232+
- name: Upload to GitHub Pages
233+
if: github.event_name == 'push'
234+
uses: actions/upload-pages-artifact@v3
235+
with:
236+
path: ./target/generated-docs
237+
238+
- name: Deploy to GitHub Pages
239+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
240+
uses: actions/deploy-pages@v4
241+
id: deployment

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,8 @@
1717
# User-specific environment configuration
1818
.envrc
1919

20-
# Generated HTML (from AsciiDoc)
21-
*.html
20+
# Generated HTML and site output (from AsciiDoc)
21+
*.html
22+
23+
# Maven artifacts
24+
target/
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
wrapperVersion=3.3.4
2+
distributionType=only-script
3+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip

mvnw

Lines changed: 295 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)