-
Notifications
You must be signed in to change notification settings - Fork 23
chore: Enable JavaDoc Aggregate with Delombok #969
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 19 commits
7cbb121
1a8add4
a4ce86e
bc39fe9
9359b53
b5aafc5
28eeb9f
57aee5d
38a60a7
fa71e3a
8af65c4
542ada5
737b225
82fcb61
bd6fb25
d1465b8
1144530
fceadbb
16f60da
6f9268f
a9ffff5
5e99baa
5febe31
df0c9df
f8c6dfa
3d011e3
a83cecc
4d63eb8
9ea19cf
46fe88e
3b580e5
c4b7908
0ebdce0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| name: JavaDoc to Documentation Portal | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| branch: | ||
| description: 'Branch to clone' | ||
| required: true | ||
| default: 'rel/5.24.0' | ||
|
|
||
| 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 "[email protected]" | ||
| 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 | ||
| echo ${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 }} | ||
|
Comment on lines
98
to
110
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should add a TODO to the PR created in the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the workflow is triggered async, I can't put a direct URL to the upcoming JavaDoc PR. |
||
Uh oh!
There was an error while loading. Please reload this page.