Skip to content

Commit

Permalink
javadoc github action
Browse files Browse the repository at this point in the history
  • Loading branch information
jwoglom committed Dec 26, 2024
1 parent b058ac2 commit def1281
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 0 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/javadoc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: javadoc

on:
push:
branches: [ dev ]
paths: [ '**.java', '.github/workflows/javadoc.yml' ]
release:
types: [created]
workflow_dispatch:

jobs:
docs:
runs-on: ubuntu-latest

steps:
- name: Checkout the repo
uses: actions/checkout@v3

- name: set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build docs with Maven
run: ./gradlew javadoc

- name: Checkout the gh-pages branch
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: gh-pages
path: gh-pages

- name: Copy to Documentation Website Location
run: |
mkdir -p gh-pages/javadoc/messages
rm -rf gh-pages/javadoc/messages
cp -rf messages/build/docs/javadoc/. gh-pages/javadoc/messages/
- name: Tidy up the javadocs
id: tidy
uses: cicirello/javadoc-cleanup@v1
with:
base-url-path: https://jwoglom.github.io/pumpx2/javadoc/
path-to-root: gh-pages/javadoc/messages
user-defined-block: |
<meta name="referrer" content="strict-origin-when-cross-origin">
- name: Log javadoc-cleanup output
run: |
echo "modified-count = ${{ steps.tidy.outputs.modified-count }}"
- name: Commit documentation changes without pushing yet
run: |
cd gh-pages
if [[ `git status --porcelain` ]]; then
git config --global user.name 'github-actions'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add -A
git commit -m "Javadoc update $(date)"
fi
cd ..
- name: Generate the sitemap
id: sitemap
uses: cicirello/generate-sitemap@v1
with:
base-url-path: https://jwoglom.github.io/pumpx2/javadoc/
path-to-root: gh-pages

- name: Output stats
run: |
echo "sitemap-path = ${{ steps.sitemap.outputs.sitemap-path }}"
echo "url-count = ${{ steps.sitemap.outputs.url-count }}"
echo "excluded-count = ${{ steps.sitemap.outputs.excluded-count }}"
- name: Commit documentation website sitemap and push all commits
run: |
cd gh-pages
if [[ `git status --porcelain` ]]; then
git config --global user.name 'github-actions'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add -A
git commit -m "Sitemap update $(date)"
fi
git push
cd ..
5 changes: 5 additions & 0 deletions messages/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ java {
targetCompatibility = JavaVersion.VERSION_1_8
}

tasks.javadoc {
source = sourceSets.main.allJava
options.linkSource = true
}

publishing {
publications {
"$project.name"(MavenPublication) {
Expand Down

0 comments on commit def1281

Please sign in to comment.