Skip to content
Open
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
4 changes: 3 additions & 1 deletion .github/workflows/cache-maven-dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ env:
jobs:
update-cache:
runs-on: ubuntu-latest
permissions:
actions: write # needed to delete caches
steps:
- name: "Checkout"
uses: actions/checkout@v6
Expand All @@ -36,7 +38,7 @@ jobs:
gh cache delete "${CACHE_ID}"
done
env:
GH_TOKEN: ${{ secrets.BOT_SDK_JS_FOR_DOCS_REPO_PR }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: "Cache Dependencies"
uses: actions/cache/save@v5
Expand Down
22 changes: 15 additions & 7 deletions .github/workflows/dependabot-automerge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,21 @@ env:
jobs:
review-prs:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v6

- name: 'Create GitHub App Token'
id: app-token
uses: actions/create-github-app-token@v3
with:
app-id: ${{ secrets.SAP_CLOUD_SDK_BOT_CLIENT_ID }}
private-key: ${{ secrets.SAP_CLOUD_SDK_BOT_PRIVATE_KEY }}
owner: SAP
repositories: cloud-sdk-java
permission-contents: write
permission-pull-requests: write

- name: Approve and Merge PRs
run: |
PRS=$(gh pr list --app "dependabot" --state "open" --json number,title)
Expand All @@ -29,14 +37,14 @@ jobs:
if [[ -z "$GROUP" ]]; then
continue
fi

MATCHES=$(jq -r --arg group "$GROUP" '.[] | select(.title | contains($group)) | .number' <<< "$PRS")
echo "[DEBUG] Found PRs for group '$GROUP': '$MATCHES'"

PR_NUMBERS="$MATCHES"$'\n'"$PR_NUMBERS"
done <<< "${{ env.DEPENDABOT_GROUPS }}"
echo "[DEBUG] Approving and Merging following PRs: '$PR_NUMBERS'"

while IFS= read -r PR_NUMBER; do
if [[ -z "$PR_NUMBER" ]]; then
continue
Expand All @@ -47,4 +55,4 @@ jobs:
gh pr review "$PR_NUMBER" --approve
done <<< "$PR_NUMBERS"
env:
GH_TOKEN: ${{ secrets.BOT_SDK_JS_FOR_DOCS_REPO_PR }}
GH_TOKEN: ${{ steps.app-token.outputs.token }}
45 changes: 28 additions & 17 deletions .github/workflows/javadoc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,60 +11,71 @@ on:
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"
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"
name: 'JavaDoc to Documentation Portal'
runs-on: ubuntu-latest

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

- name: "Checkout Repository"
- name: 'Checkout Repository'
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: "Switch branch"

- name: 'Switch branch'
run: git checkout "${{ github.event.inputs.branch || 'main' }}"

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

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

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

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

- name: "Copy delombok sources"
- 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"
- name: 'Generate aggregated Javadoc'
run: mvn clean javadoc:aggregate -Drelease -Djava.failOnWarning=false --projects "${PROJECTS}" --quiet

- name: "Checkout Docs Repository"
- name: 'Create GitHub App Token'
id: app-token
uses: actions/create-github-app-token@v3
with:
app-id: ${{ secrets.SAP_CLOUD_SDK_BOT_CLIENT_ID }}
private-key: ${{ secrets.SAP_CLOUD_SDK_BOT_PRIVATE_KEY }}
owner: SAP
repositories: cloud-sdk
permission-contents: write
permission-pull-requests: write

- name: 'Checkout Docs Repository'
uses: actions/checkout@v6
with:
repository: ${{ env.DOCS_REPO }}
path: .cloud-sdk-docs
token: ${{ secrets.BOT_SDK_JS_FOR_DOCS_REPO_PR }}
token: ${{ steps.app-token.outputs.token }}

- name: "Replace JavaDoc"
- name: 'Replace JavaDoc'
id: replace-javadoc
run: |
TARGET_DIR=./.cloud-sdk-docs/static/java-api/v${{ steps.determine-version.outputs.MAJOR_VERSION }}
Expand Down Expand Up @@ -95,7 +106,7 @@ jobs:

git push origin $BRANCH_NAME

- name: "Create JavaDoc PR"
- name: 'Create JavaDoc PR'
id: create-javadoc-pr
if: ${{ steps.replace-javadoc.outputs.CREATE_PR == 'true' }}
working-directory: ./.cloud-sdk-docs
Expand All @@ -107,4 +118,4 @@ jobs:
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 }}
GH_TOKEN: ${{ steps.app-token.outputs.token }}
85 changes: 52 additions & 33 deletions .github/workflows/perform-release.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: "Perform Release"
name: 'Perform Release'

on:
workflow_dispatch:
inputs:
release_pr_number:
description: "The PR number of the release PR"
description: 'The PR number of the release PR'
required: true
skip-pr-merge:
description: "Whether to skip merging the PRs"
description: 'Whether to skip merging the PRs'
required: false
default: false
type: boolean
Expand All @@ -19,7 +19,7 @@ env:

jobs:
prerequisites:
name: "Prerequisites"
name: 'Prerequisites'
outputs:
code-branch: ${{ steps.determine-branch-names.outputs.CODE_BRANCH_NAME }}
docs-branch: ${{ steps.determine-branch-names.outputs.DOCS_BRANCH_NAME }}
Expand All @@ -30,7 +30,7 @@ jobs:
permissions: write-all # contents and push are needed to see the draft release
runs-on: ubuntu-latest
steps:
- name: "Determine Branch Names"
- name: 'Determine Branch Names'
id: determine-branch-names
run: |
CODE_BRANCH_NAME=$(gh pr view ${{github.event.inputs.release_pr_number}} --repo ${{github.repository}} --json headRefName --jq '.headRefName')
Expand All @@ -39,22 +39,22 @@ jobs:
RELEASE_COMMIT=$(gh release view $RELEASE_TAG --repo ${{github.repository}} --json targetCommitish --jq '.targetCommitish')
RELEASE_NOTES_BRANCH_NAME=java/release-notes-$RELEASE_VERSION
RELEASE_JAVADOC_BRANCH_NAME=java/release-docs-$RELEASE_VERSION

echo "CODE_BRANCH_NAME=$CODE_BRANCH_NAME" >> $GITHUB_OUTPUT
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_OUTPUT
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_OUTPUT
echo "RELEASE_COMMIT=$RELEASE_COMMIT" >> $GITHUB_OUTPUT
echo "RELEASE_NOTES_BRANCH_NAME=$RELEASE_NOTES_BRANCH_NAME" >> $GITHUB_OUTPUT
echo "RELEASE_JAVADOC_BRANCH_NAME=$RELEASE_JAVADOC_BRANCH_NAME" >> $GITHUB_OUTPUT

echo -e "[DEBUG] Current GITHUB_OUTPUT:\n$(cat $GITHUB_OUTPUT)"
env:
GH_TOKEN: ${{ github.token }}

- name: "Checkout Repository"
- name: 'Checkout Repository'
uses: actions/checkout@v6

- name: "Check Whether Code PR Can Be Merged"
- name: 'Check Whether Code PR Can Be Merged'
if: ${{ inputs.skip-pr-merge != 'true' }}
uses: ./.github/actions/pr-is-mergeable
with:
Expand All @@ -65,53 +65,72 @@ jobs:
\"dependabot merger\": []
}

- name: "Check Code Release Commit Continuous Integration"
- name: 'Check Code Release Commit Continuous Integration'
if: ${{ inputs.skip-pr-merge != 'true' }}
uses: ./.github/actions/workflow-succeeded
with:
workflow: "Continuous Integration"
workflow: 'Continuous Integration'
sha: ${{ steps.determine-branch-names.outputs.RELEASE_COMMIT }}
excluded-jobs: "[\"Run BlackDuck Scan\"]"
excluded-jobs: '["Run BlackDuck Scan"]'

- name: 'Create GitHub App Token'
id: app-token
uses: actions/create-github-app-token@v3
with:
app-id: ${{ secrets.SAP_CLOUD_SDK_BOT_CLIENT_ID }}
private-key: ${{ secrets.SAP_CLOUD_SDK_BOT_PRIVATE_KEY }}
owner: SAP
repositories: cloud-sdk

- name: "Check Whether Release Notes PR Can Be Merged"
- name: 'Check Whether Release Notes PR Can Be Merged'
if: ${{ inputs.skip-pr-merge != 'true' }}
uses: ./.github/actions/pr-is-mergeable
with:
pr-ref: ${{ steps.determine-branch-names.outputs.RELEASE_NOTES_BRANCH_NAME }}
repo: ${{ env.DOCS_REPO }}
token: ${{ secrets.BOT_SDK_JS_FOR_DOCS_REPO_PR }}
token: ${{ steps.app-token.outputs.token }}
excluded-check-runs: |
{
\"Build Cloud SDK Documentation\": [\"dependabot\"]
}

- name: "Check Whether JavaDoc PR Can Be Merged"
- name: 'Check Whether JavaDoc PR Can Be Merged'
if: ${{ inputs.skip-pr-merge != 'true' }}
uses: ./.github/actions/pr-is-mergeable
with:
pr-ref: ${{ steps.determine-branch-names.outputs.RELEASE_JAVADOC_BRANCH_NAME }}
repo: ${{ env.DOCS_REPO }}
token: ${{ secrets.BOT_SDK_JS_FOR_DOCS_REPO_PR }}
token: ${{ steps.app-token.outputs.token }}
excluded-check-runs: |
{
\"Build Cloud SDK Documentation\": [\"dependabot\"]
}

release:
name: "Release"
needs: [ prerequisites ]
name: 'Release'
needs: [prerequisites]
runs-on: ubuntu-latest
permissions:
contents: write # needed to modify the release draft
pull-requests: write # needed to merge the release PR
steps:
- name: "Setup java"
- name: 'Create GitHub App Token'
id: app-token
uses: actions/create-github-app-token@v3
with:
app-id: ${{ secrets.SAP_CLOUD_SDK_BOT_CLIENT_ID }}
private-key: ${{ secrets.SAP_CLOUD_SDK_BOT_PRIVATE_KEY }}
owner: SAP
repositories: cloud-sdk-java,cloud-sdk
permission-contents: write
permission-pull-requests: write # needed to merge the release PR

- name: 'Setup java'
uses: actions/setup-java@v5
with:
distribution: "sapmachine"
distribution: 'sapmachine'
java-version: ${{ env.JAVA_VERSION }}

- name: "Download Release Asset"
- name: 'Download Release Asset'
id: download-asset
run: |
gh release download ${{ needs.prerequisites.outputs.release-tag }} --dir ./ --repo "${{ github.repository }}"
Expand All @@ -120,42 +139,42 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: "Import GPG Key"
- name: 'Import GPG Key'
run: |
echo "${{ secrets.PGP_PRIVATE_KEY }}" | gpg --batch --passphrase "$MAVEN_GPG_PASSPHRASE" --import
env:
MAVEN_GPG_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}

- name: "Create settings.xml"
- name: 'Create settings.xml'
run: |
echo '${{ secrets.CENTRAL_SONATYPE_SETTINGS_XML }}' > settings.xml

- name: "Deploy"
- name: 'Deploy'
run: |
MVN_ARGS="${{ env.MVN_CLI_ARGS }} -Drelease -s settings.xml"
mvn deploy $MVN_ARGS
env:
MAVEN_GPG_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}

- name: "Merge Code PR"
- name: 'Merge Code PR'
if: ${{ inputs.skip-pr-merge != 'true' }}
run: gh pr merge --squash "${{ needs.prerequisites.outputs.code-branch }}" --delete-branch --repo "${{ github.repository }}"
env:
GH_TOKEN: ${{ secrets.BOT_SDK_JS_FOR_DOCS_REPO_PR }}
GH_TOKEN: ${{ steps.app-token.outputs.token }}

- name: "Publish the Draft Release"
- name: 'Publish the Draft Release'
run: gh release edit ${{ needs.prerequisites.outputs.release-tag }} --draft=false --repo "${{ github.repository }}"
env:
GH_TOKEN: ${{ secrets.BOT_SDK_JS_FOR_DOCS_REPO_PR }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: "Merge Release Notes PR"
- name: 'Merge Release Notes PR'
if: ${{ inputs.skip-pr-merge != 'true' }}
run: gh pr merge --squash "${{ needs.prerequisites.outputs.release-notes-branch }}" --delete-branch --repo "${{ env.DOCS_REPO }}"
env:
GH_TOKEN: ${{ secrets.BOT_SDK_JS_FOR_DOCS_REPO_PR }}
GH_TOKEN: ${{ steps.app-token.outputs.token }}

- name: "Merge JavaDoc PR"
- name: 'Merge JavaDoc PR'
if: ${{ inputs.skip-pr-merge != 'true' }}
run: gh pr merge --squash "${{ needs.prerequisites.outputs.release-javadoc-branch }}" --delete-branch --repo "${{ env.DOCS_REPO }}"
env:
GH_TOKEN: ${{ secrets.BOT_SDK_JS_FOR_DOCS_REPO_PR }}
GH_TOKEN: ${{ steps.app-token.outputs.token }}
Loading
Loading