diff --git a/.github/workflows/perform-release.yaml b/.github/workflows/perform-release.yaml index 12670fd5f..82ad5ddd6 100644 --- a/.github/workflows/perform-release.yaml +++ b/.github/workflows/perform-release.yaml @@ -26,34 +26,34 @@ jobs: statuses: read checks: read actions: read - outputs: - code-branch: ${{ steps.determine-branch-names.outputs.CODE_BRANCH_NAME }} - release-notes-branch: ${{ steps.determine-branch-names.outputs.RELEASE_NOTES_BRANCH_NAME }} - javadoc-branch: ${{ steps.determine-branch-names.outputs.JAVADOC_BRANCH_NAME }} - release-tag: ${{ steps.determine-branch-names.outputs.RELEASE_TAG }} - release-commit: ${{ steps.determine-branch-names.outputs.RELEASE_COMMIT }} +# outputs: +# code-branch: ${{ steps.determine-branch-names.outputs.CODE_BRANCH_NAME }} +# release-notes-branch: ${{ steps.determine-branch-names.outputs.RELEASE_NOTES_BRANCH_NAME }} +# javadoc-branch: ${{ steps.determine-branch-names.outputs.JAVADOC_BRANCH_NAME }} +# release-tag: ${{ steps.determine-branch-names.outputs.RELEASE_TAG }} +# release-commit: ${{ steps.determine-branch-names.outputs.RELEASE_COMMIT }} runs-on: ubuntu-latest steps: - - 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') - RELEASE_VERSION=$(echo $CODE_BRANCH_NAME | cut -d '-' -f2) - RELEASE_TAG=rel/$RELEASE_VERSION - RELEASE_COMMIT=$(gh release view $RELEASE_TAG --repo ${{github.repository}} --json targetCommitish --jq '.targetCommitish') - RELEASE_NOTES_BRANCH_NAME=java/release-notes-$RELEASE_VERSION - 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 "JAVADOC_BRANCH_NAME=$JAVADOC_BRANCH_NAME" >> $GITHUB_OUTPUT - - echo -e "[DEBUG] Current GITHUB_OUTPUT:\n$(cat $GITHUB_OUTPUT)" - env: - GH_TOKEN: ${{ github.token }} +# - 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') +# RELEASE_VERSION=$(echo $CODE_BRANCH_NAME | cut -d '-' -f2) +# RELEASE_TAG=rel/$RELEASE_VERSION +# RELEASE_COMMIT=$(gh release view $RELEASE_TAG --repo ${{github.repository}} --json targetCommitish --jq '.targetCommitish') +# RELEASE_NOTES_BRANCH_NAME=java/release-notes-$RELEASE_VERSION +# 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 "JAVADOC_BRANCH_NAME=$JAVADOC_BRANCH_NAME" >> $GITHUB_OUTPUT +# +# echo -e "[DEBUG] Current GITHUB_OUTPUT:\n$(cat $GITHUB_OUTPUT)" +# env: +# GH_TOKEN: ${{ github.token }} - name: 'Generate GitHub App token' id: app-token @@ -65,70 +65,71 @@ jobs: repositories: ai-sdk permission-pull-requests: read - - name: 'Checkout Repository' - uses: actions/checkout@v6 - - - name: 'Check Whether Code PR Can Be Merged' - if: ${{ inputs.skip-pr-merge != 'true' }} - uses: ./.github/actions/pr-is-mergeable - with: - pr-ref: ${{ steps.determine-branch-names.outputs.CODE_BRANCH_NAME }} - excluded-check-runs: | - { - \"Continuous Integration\": [\"Run BlackDuck Scan\", \"Run Security Rating\"], - \"dependabot merger\": [] - } - - - name: 'Check Code Release Commit Continuous Integration' - if: ${{ inputs.skip-pr-merge != 'true' }} - uses: ./.github/actions/workflow-succeeded - with: - workflow: 'Continuous Integration' - sha: ${{ steps.determine-branch-names.outputs.RELEASE_COMMIT }} - - - 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: ${{ steps.app-token.outputs.token }} - excluded-check-runs: | - { - \"Build Cloud SDK Documentation\": [\"dependabot\"] - } - - - 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.JAVADOC_BRANCH_NAME }} - repo: ${{ env.DOCS_REPO }} - token: ${{ steps.app-token.outputs.token }} - excluded-check-runs: | - { - \"Build Cloud SDK Documentation\": [\"dependabot\"] - } +# - name: 'Checkout Repository' +# uses: actions/checkout@v6 +# +# - name: 'Check Whether Code PR Can Be Merged' +# if: ${{ inputs.skip-pr-merge != 'true' }} +# uses: ./.github/actions/pr-is-mergeable +# with: +# pr-ref: ${{ steps.determine-branch-names.outputs.CODE_BRANCH_NAME }} +# excluded-check-runs: | +# { +# \"Continuous Integration\": [\"Run BlackDuck Scan\", \"Run Security Rating\"], +# \"dependabot merger\": [] +# } +# +# - name: 'Check Code Release Commit Continuous Integration' +# if: ${{ inputs.skip-pr-merge != 'true' }} +# uses: ./.github/actions/workflow-succeeded +# with: +# workflow: 'Continuous Integration' +# sha: ${{ steps.determine-branch-names.outputs.RELEASE_COMMIT }} +# +# - 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: ${{ steps.app-token.outputs.token }} +# excluded-check-runs: | +# { +# \"Build Cloud SDK Documentation\": [\"dependabot\"] +# } +# +# - 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.JAVADOC_BRANCH_NAME }} +# repo: ${{ env.DOCS_REPO }} +# token: ${{ steps.app-token.outputs.token }} +# excluded-check-runs: | +# { +# \"Build Cloud SDK Documentation\": [\"dependabot\"] +# } release: name: 'Release' needs: [prerequisites] runs-on: ubuntu-latest + environment: release permissions: contents: read steps: - - name: 'Generate GitHub App token' - id: app-token - uses: actions/create-github-app-token@v3 - with: - client-id: ${{ secrets.SAP_AI_SDK_BOT_CLIENT_ID }} - private-key: ${{ secrets.SAP_AI_SDK_BOT_PRIVATE_KEY }} - owner: SAP - repositories: | - ai-sdk-java - ai-sdk - permission-contents: write # needed to modify the release draft - permission-pull-requests: write # needed to merge the release PR +# - name: 'Generate GitHub App token' +# id: app-token +# uses: actions/create-github-app-token@v3 +# with: +# client-id: ${{ secrets.SAP_AI_SDK_BOT_CLIENT_ID }} +# private-key: ${{ secrets.SAP_AI_SDK_BOT_PRIVATE_KEY }} +# owner: SAP +# repositories: | +# ai-sdk-java +# ai-sdk +# permission-contents: write # needed to modify the release draft +# permission-pull-requests: write # needed to merge the release PR - name: 'Setup java' uses: actions/setup-java@v5 @@ -136,14 +137,14 @@ jobs: distribution: 'sapmachine' java-version: ${{ env.JAVA_VERSION }} - - name: 'Download Release Asset' - id: download-asset - run: | - gh release download ${{ needs.prerequisites.outputs.release-tag }} --dir ./ --repo "${{ github.repository }}" - # x=extract v=verbose z=decompress f=file C=destination directory - tar -xvzf release-artifacts.tar.gz -C . - env: - GH_TOKEN: ${{ steps.app-token.outputs.token }} +# - name: 'Download Release Asset' +# id: download-asset +# run: | +# gh release download ${{ needs.prerequisites.outputs.release-tag }} --dir ./ --repo "${{ github.repository }}" +# # x=extract v=verbose z=decompress f=file C=destination directory +# tar -xvzf release-artifacts.tar.gz -C . +# env: +# GH_TOKEN: ${{ steps.app-token.outputs.token }} - name: 'Import GPG Key' run: | @@ -155,32 +156,32 @@ jobs: run: | echo '${{ secrets.CENTRAL_SONATYPE_SETTINGS_XML }}' > settings.xml - - 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' - if: ${{ inputs.skip-pr-merge != 'true' }} - run: gh pr merge --squash "${{ needs.prerequisites.outputs.code-branch }}" --delete-branch --repo "${{ github.repository }}" - env: - GH_TOKEN: ${{ steps.app-token.outputs.token }} - - - name: 'Publish the Draft Release' - run: gh release edit ${{ needs.prerequisites.outputs.release-tag }} --draft=false --repo "${{ github.repository }}" - env: - GH_TOKEN: ${{ steps.app-token.outputs.token }} - - - 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: ${{ steps.app-token.outputs.token }} - - - name: 'Merge JavaDoc PR' - if: ${{ inputs.skip-pr-merge != 'true' }} - run: gh pr merge --squash "${{ needs.prerequisites.outputs.javadoc-branch }}" --delete-branch --repo "${{ env.DOCS_REPO }}" - env: - GH_TOKEN: ${{ steps.app-token.outputs.token }} +# - 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' +# if: ${{ inputs.skip-pr-merge != 'true' }} +# run: gh pr merge --squash "${{ needs.prerequisites.outputs.code-branch }}" --delete-branch --repo "${{ github.repository }}" +# env: +# GH_TOKEN: ${{ steps.app-token.outputs.token }} +# +# - name: 'Publish the Draft Release' +# run: gh release edit ${{ needs.prerequisites.outputs.release-tag }} --draft=false --repo "${{ github.repository }}" +# env: +# GH_TOKEN: ${{ steps.app-token.outputs.token }} +# +# - 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: ${{ steps.app-token.outputs.token }} +# +# - name: 'Merge JavaDoc PR' +# if: ${{ inputs.skip-pr-merge != 'true' }} +# run: gh pr merge --squash "${{ needs.prerequisites.outputs.javadoc-branch }}" --delete-branch --repo "${{ env.DOCS_REPO }}" +# env: +# GH_TOKEN: ${{ steps.app-token.outputs.token }}