Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 107 additions & 0 deletions .github/workflows/javadoc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: JavaDoc to Documentation Portal

on:
workflow_dispatch:
inputs:
branch:
description: 'Branch/Commit/Tag for JavaDoc'
required: true
default: 'main'

env:
JAVA_VERSION: 17
DOCS_REPO: SAP/cloud-sdk
PROJECTS: "!:rfc,!:dwc-cf,!:datamodel-metadata-generator,!:odata-generator,!:odata-generator-maven-plugin,!:odata-generator-utility,!:odata-v4-generator,!:odata-v4-generator-maven-plugin,!:s4hana-connectivity,!:soap,!:testutil,!:s4hana-core"

jobs:
build:
name: "JavaDoc to Documentation Portal"
runs-on: ubuntu-latest

steps:
- name: "Prepare git"
run: |
git config --global user.email "cloudsdk@sap.com"
git config --global user.name "SAP Cloud SDK Bot"

- name: "Checkout Repository"
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "Switch branch"
run: git checkout "${{ github.event.inputs.branch || 'main' }}"

- name: "Set up JDK 17"
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'

- name: "Determine Major Version"
id: determine-major-version
run: echo "MAJOR_VERSION=$(jq -r '.version' latest.json | cut -d '.' -f 1)" >> $GITHUB_OUTPUT

- name: "Install project (skip tests)"
run: mvn install -DskipTests --quiet

- name: "Process sources"
run: mvn process-sources -Drelease --fail-at-end --projects "${PROJECTS}" --quiet

- name: "Copy delombok sources"
run: find . -type d -path "*/target/delombok" -exec sh -c 'cp -r "$1"/* "$(dirname $(dirname "$1"))/src/main/java/"' _ {} \;

- name: "Generate aggregated Javadoc"
run: mvn clean javadoc:aggregate -Drelease -Djava.failOnWarning=false --projects "${PROJECTS}" --quiet

- name: "Checkout Docs Repository"
uses: actions/checkout@v4
with:
repository: ${{ env.DOCS_REPO }}
path: .cloud-sdk-docs
token: ${{ secrets.BOT_SDK_JS_FOR_DOCS_REPO_PR }}

- name: "Replace JavaDoc"
id: replace-javadoc
run: |
TARGET_DIR=./.cloud-sdk-docs/static/java-api/v${{ steps.determine-major-version.outputs.MAJOR_VERSION }}

ls -lA target
rm -rf $TARGET_DIR
mkdir -p $TARGET_DIR
mv target/reports/apidocs/* $TARGET_DIR

cd ./.cloud-sdk-docs
git add -A .

CHANGED_FILES="$(git status -s)"
if [[ -z "$CHANGED_FILES" ]]; then
echo "[DEBUG] No changes to API docs detected, skipping Pull Request creation."
echo "CREATE_PR=false" >> $GITHUB_OUTPUT
exit 0
fi

echo "CREATE_PR=true" >> $GITHUB_OUTPUT
BRANCH_NAME=java/release-docs-${{ steps.determine-major-version.outputs.MAJOR_VERSION }}
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_OUTPUT

git switch --create $BRANCH_NAME
git commit -m "chore: Update JavaDocs for release ${{ needs.bump-version.outputs.release-version }}"
COMMIT_SHA=$(git log -1 --pretty=format:"%H")
echo "COMMIT_SHA=$COMMIT_SHA" >> $GITHUB_OUTPUT

git push origin $BRANCH_NAME

- name: "Create JavaDoc PR"
id: create-javadoc-pr
if: ${{ steps.replace-javadoc.outputs.CREATE_PR == 'true' }}
working-directory: ./.cloud-sdk-docs
run: |
PR_TITLE="Java: Update JavaDocs for release ${{ needs.bump-version.outputs.release-version }}"
PR_BODY="Replace the contents of v${{ steps.determine-major-version.outputs.MAJOR_VERSION }} API docs with the latest release of the SDK."

PR_URL=$(gh pr create --title "$PR_TITLE" --body "$PR_BODY" --repo "${{ env.DOCS_REPO }}")
echo "PR_URL=$PR_URL" >> $GITHUB_OUTPUT
echo "PR: $PR_URL" >> $GITHUB_STEP_SUMMARY
env:
GH_TOKEN: ${{ secrets.BOT_SDK_JS_FOR_DOCS_REPO_PR }}
20 changes: 20 additions & 0 deletions .github/workflows/prepare-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,26 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}

create-javadoc-aggregated-pr:
needs: [ create-release ]
name: "Create Aggregated JavaDoc PR on Documentation Portal"
runs-on: ubuntu-latest
permissions:
actions: write # needed to trigger the ci-build workflow
statuses: write # needed to update the commit status
steps:
- name: "Checkout repository"
uses: actions/checkout@v5
with:
ref: ${{ needs.create-release.outputs.release-name }}
- name: "Trigger workflow (ignore failures)"
uses: ./.github/actions/trigger-workflow
continue-on-error: true
with:
workflow: javadoc.yaml
workflow-ref: javadoc-aggregate-delombok
parameters: -f branch=${{ needs.create-release.outputs.release-name }}

create-release-notes-pr:
name: "Create Release Notes PR"
needs: [ bump-version, run-ci ]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
![build](https://github.com/SAP/cloud-sdk-java/actions/workflows/continuous-integration.yaml/badge.svg?branch=main)
[![REUSE status](https://api.reuse.software/badge/github.com/SAP/cloud-sdk-java)](https://api.reuse.software/info/github.com/SAP/cloud-sdk-java)
[![Fosstars security rating](https://github.com/SAP/cloud-sdk-java/blob/fosstars-report/fosstars_badge.svg)](https://github.com/SAP/cloud-sdk-java/blob/fosstars-report/fosstars_report.md)
[![Maven Central](https://img.shields.io/badge/maven_central-5.23.0-blue.svg)](https://search.maven.org/search?q=g:com.sap.cloud.sdk%20AND%20a:sdk-core%20AND%20v:5.23.0)
[![Maven Central](https://img.shields.io/badge/maven_central-5.24.0-M4-blue.svg)](https://search.maven.org/search?q=g:com.sap.cloud.sdk%20AND%20a:sdk-core%20AND%20v:5.24.0-M4)
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/SAP/cloud-sdk-java)

# <img src="https://sap.github.io/cloud-sdk/img/logo.svg" alt="SAP Cloud SDK" width="30"/> SAP Cloud SDK for Java
Expand Down
4 changes: 3 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,6 @@
<packages>com.sap.cloud.sdk.s4hana*</packages>
</group>
</groups>
<sourcepath>${project.basedir}/target/delombok</sourcepath>
<overview>${project.rootdir}/javadoc.overview.html</overview>
</configuration>
<executions>
Expand All @@ -1024,6 +1023,9 @@
<goals>
<goal>jar</goal>
</goals>
<configuration>
<sourcepath>${project.basedir}/target/delombok</sourcepath>
</configuration>
</execution>
</executions>
</plugin>
Expand Down
Loading