1- name : " Perform Release"
1+ name : ' Perform Release'
22
33on :
44 workflow_dispatch :
55 inputs :
66 release_pr_number :
7- description : " The PR number of the release PR"
7+ description : ' The PR number of the release PR'
88 required : true
99 skip-pr-merge :
10- description : " Whether to skip merging the PRs"
10+ description : ' Whether to skip merging the PRs'
1111 required : false
1212 default : false
1313 type : boolean
1919
2020jobs :
2121 prerequisites :
22- name : " Prerequisites"
22+ name : ' Prerequisites'
2323 outputs :
2424 code-branch : ${{ steps.determine-branch-names.outputs.CODE_BRANCH_NAME }}
2525 docs-branch : ${{ steps.determine-branch-names.outputs.DOCS_BRANCH_NAME }}
3030 permissions : write-all # contents and push are needed to see the draft release
3131 runs-on : ubuntu-latest
3232 steps :
33- - name : " Determine Branch Names"
33+ - name : ' Determine Branch Names'
3434 id : determine-branch-names
3535 run : |
3636 CODE_BRANCH_NAME=$(gh pr view ${{github.event.inputs.release_pr_number}} --repo ${{github.repository}} --json headRefName --jq '.headRefName')
@@ -39,22 +39,22 @@ jobs:
3939 RELEASE_COMMIT=$(gh release view $RELEASE_TAG --repo ${{github.repository}} --json targetCommitish --jq '.targetCommitish')
4040 RELEASE_NOTES_BRANCH_NAME=java/release-notes-$RELEASE_VERSION
4141 RELEASE_JAVADOC_BRANCH_NAME=java/release-docs-$RELEASE_VERSION
42-
42+
4343 echo "CODE_BRANCH_NAME=$CODE_BRANCH_NAME" >> $GITHUB_OUTPUT
4444 echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_OUTPUT
4545 echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_OUTPUT
4646 echo "RELEASE_COMMIT=$RELEASE_COMMIT" >> $GITHUB_OUTPUT
4747 echo "RELEASE_NOTES_BRANCH_NAME=$RELEASE_NOTES_BRANCH_NAME" >> $GITHUB_OUTPUT
4848 echo "RELEASE_JAVADOC_BRANCH_NAME=$RELEASE_JAVADOC_BRANCH_NAME" >> $GITHUB_OUTPUT
49-
49+
5050 echo -e "[DEBUG] Current GITHUB_OUTPUT:\n$(cat $GITHUB_OUTPUT)"
5151 env :
5252 GH_TOKEN : ${{ github.token }}
5353
54- - name : " Checkout Repository"
54+ - name : ' Checkout Repository'
5555 uses : actions/checkout@v6
5656
57- - name : " Check Whether Code PR Can Be Merged"
57+ - name : ' Check Whether Code PR Can Be Merged'
5858 if : ${{ inputs.skip-pr-merge != 'true' }}
5959 uses : ./.github/actions/pr-is-mergeable
6060 with :
@@ -65,53 +65,72 @@ jobs:
6565 \"dependabot merger\": []
6666 }
6767
68- - name : " Check Code Release Commit Continuous Integration"
68+ - name : ' Check Code Release Commit Continuous Integration'
6969 if : ${{ inputs.skip-pr-merge != 'true' }}
7070 uses : ./.github/actions/workflow-succeeded
7171 with :
72- workflow : " Continuous Integration"
72+ workflow : ' Continuous Integration'
7373 sha : ${{ steps.determine-branch-names.outputs.RELEASE_COMMIT }}
74- excluded-jobs : " [ \ " Run BlackDuck Scan\" ] "
74+ excluded-jobs : ' [ "Run BlackDuck Scan"] '
7575
76- - name : " Check Whether Release Notes PR Can Be Merged"
76+ - name : ' Create GitHub App Token'
77+ id : create-app-token
78+ uses : actions/create-github-app-token@v3
79+ with :
80+ app-id : ${{ secrets.SAP_CLOUD_SDK_BOT_CLIENT_ID }}
81+ private-key : ${{ secrets.SAP_CLOUD_SDK_BOT_PRIVATE_KEY }}
82+ owner : SAP
83+ repositories : cloud-sdk
84+
85+ - name : ' Check Whether Release Notes PR Can Be Merged'
7786 if : ${{ inputs.skip-pr-merge != 'true' }}
7887 uses : ./.github/actions/pr-is-mergeable
7988 with :
8089 pr-ref : ${{ steps.determine-branch-names.outputs.RELEASE_NOTES_BRANCH_NAME }}
8190 repo : ${{ env.DOCS_REPO }}
82- token : ${{ secrets.BOT_SDK_JS_FOR_DOCS_REPO_PR }}
91+ token : ${{ steps.create-app-token.outputs.token }}
8392 excluded-check-runs : |
8493 {
8594 \"Build Cloud SDK Documentation\": [\"dependabot\"]
8695 }
8796
88- - name : " Check Whether JavaDoc PR Can Be Merged"
97+ - name : ' Check Whether JavaDoc PR Can Be Merged'
8998 if : ${{ inputs.skip-pr-merge != 'true' }}
9099 uses : ./.github/actions/pr-is-mergeable
91100 with :
92101 pr-ref : ${{ steps.determine-branch-names.outputs.RELEASE_JAVADOC_BRANCH_NAME }}
93102 repo : ${{ env.DOCS_REPO }}
94- token : ${{ secrets.BOT_SDK_JS_FOR_DOCS_REPO_PR }}
103+ token : ${{ steps.create-app-token.outputs.token }}
95104 excluded-check-runs : |
96105 {
97106 \"Build Cloud SDK Documentation\": [\"dependabot\"]
98107 }
99108
100109 release :
101- name : " Release"
102- needs : [ prerequisites ]
110+ name : ' Release'
111+ needs : [prerequisites]
103112 runs-on : ubuntu-latest
104113 permissions :
105114 contents : write # needed to modify the release draft
106- pull-requests : write # needed to merge the release PR
107115 steps :
108- - name : " Setup java"
116+ - name : ' Create GitHub App Token'
117+ id : create-app-token
118+ uses : actions/create-github-app-token@v3
119+ with :
120+ app-id : ${{ secrets.SAP_CLOUD_SDK_BOT_CLIENT_ID }}
121+ private-key : ${{ secrets.SAP_CLOUD_SDK_BOT_PRIVATE_KEY }}
122+ owner : SAP
123+ repositories : cloud-sdk-java,cloud-sdk
124+ permission-contents : write
125+ permission-pull-requests : write # needed to merge the release PR
126+
127+ - name : ' Setup java'
109128 uses : actions/setup-java@v5
110129 with :
111- distribution : " sapmachine"
130+ distribution : ' sapmachine'
112131 java-version : ${{ env.JAVA_VERSION }}
113132
114- - name : " Download Release Asset"
133+ - name : ' Download Release Asset'
115134 id : download-asset
116135 run : |
117136 gh release download ${{ needs.prerequisites.outputs.release-tag }} --dir ./ --repo "${{ github.repository }}"
@@ -120,42 +139,42 @@ jobs:
120139 env :
121140 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
122141
123- - name : " Import GPG Key"
142+ - name : ' Import GPG Key'
124143 run : |
125144 echo "${{ secrets.PGP_PRIVATE_KEY }}" | gpg --batch --passphrase "$MAVEN_GPG_PASSPHRASE" --import
126145 env :
127146 MAVEN_GPG_PASSPHRASE : ${{ secrets.PGP_PASSPHRASE }}
128147
129- - name : " Create settings.xml"
148+ - name : ' Create settings.xml'
130149 run : |
131150 echo '${{ secrets.CENTRAL_SONATYPE_SETTINGS_XML }}' > settings.xml
132151
133- - name : " Deploy"
152+ - name : ' Deploy'
134153 run : |
135154 MVN_ARGS="${{ env.MVN_CLI_ARGS }} -Drelease -s settings.xml"
136155 mvn deploy $MVN_ARGS
137156 env :
138157 MAVEN_GPG_PASSPHRASE : ${{ secrets.PGP_PASSPHRASE }}
139158
140- - name : " Merge Code PR"
159+ - name : ' Merge Code PR'
141160 if : ${{ inputs.skip-pr-merge != 'true' }}
142161 run : gh pr merge --squash "${{ needs.prerequisites.outputs.code-branch }}" --delete-branch --repo "${{ github.repository }}"
143162 env :
144- GH_TOKEN : ${{ secrets.BOT_SDK_JS_FOR_DOCS_REPO_PR }}
163+ GH_TOKEN : ${{ steps.create-app-token.outputs.token }}
145164
146- - name : " Publish the Draft Release"
165+ - name : ' Publish the Draft Release'
147166 run : gh release edit ${{ needs.prerequisites.outputs.release-tag }} --draft=false --repo "${{ github.repository }}"
148167 env :
149168 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
150169
151- - name : " Merge Release Notes PR"
170+ - name : ' Merge Release Notes PR'
152171 if : ${{ inputs.skip-pr-merge != 'true' }}
153172 run : gh pr merge --squash "${{ needs.prerequisites.outputs.release-notes-branch }}" --delete-branch --repo "${{ env.DOCS_REPO }}"
154173 env :
155- GH_TOKEN : ${{ secrets.BOT_SDK_JS_FOR_DOCS_REPO_PR }}
174+ GH_TOKEN : ${{ steps.create-app-token.outputs.token }}
156175
157- - name : " Merge JavaDoc PR"
176+ - name : ' Merge JavaDoc PR'
158177 if : ${{ inputs.skip-pr-merge != 'true' }}
159178 run : gh pr merge --squash "${{ needs.prerequisites.outputs.release-javadoc-branch }}" --delete-branch --repo "${{ env.DOCS_REPO }}"
160179 env :
161- GH_TOKEN : ${{ secrets.BOT_SDK_JS_FOR_DOCS_REPO_PR }}
180+ GH_TOKEN : ${{ steps.create-app-token.outputs.token }}
0 commit comments