Skip to content

JavaDocs Publisher

JavaDocs Publisher #3

name: JavaDocs Publisher
# Executed automatically when a new PR is merged to master, if the release number already exists this job will fail
# This pipeline will build from main, upload the artifacts, and create the GitHub release
on:
workflow_run:
workflows: [ "Maven Central Continuous Delivery" ]
types: [ requested ]
branches:
- 'main'
workflow_dispatch:
jobs:
generate_java_docs:
env:
gpg.keyname: ${{ secrets.GPG_KEYNAME }}
gpg.passphrase: ${{ secrets.GPG_PASSPHRASE }}
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
runs-on: ubuntu-22.04
permissions:
contents: write # if you have a protection rule on your repository, you'll need to give write permission to the workflow.
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'zulu'
check-latest: true
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Set up Maven
uses: stCarolas/setup-maven@v5
with:
maven-version: 3.9.5
# Captures the engine version from the pom.xml
- name: Set Release Version Number
run: |
echo "RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: Publish updated JavaDocs
uses: MathieuSoysal/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
javadoc-branch: javadoc
java-version: 21
target-folder: javadoc # url will be https://<username>.github.io/<repo>/javadoc, This can be left as nothing to generate javadocs in the root folder.
project: maven