111111 required : false
112112 type : boolean
113113 default : false
114+ freeze-branch :
115+ description : " Freeze the branch during the release"
116+ required : false
117+ type : boolean
118+ default : true
119+ slack-channel :
120+ description : " Slack channel for notifications"
121+ required : false
122+ type : string
114123
115124 outputs :
116125 new-version :
@@ -121,12 +130,47 @@ env:
121130 USE_JIRA_SANDBOX : ${{ inputs.use-jira-sandbox == true && 'true' || 'false' }}
122131
123132jobs :
124- # Step 1: Prepare Release
133+ # This job freezes the specified branch to prevent changes during the release process.
134+ freeze-branch :
135+ name : Freeze ${{ inputs.branch }} branch
136+ if : ${{ inputs.freeze-branch }}
137+ runs-on : ${{ inputs.runner-environment }}
138+ permissions :
139+ id-token : write
140+ steps :
141+ - &freeze-branch-secrets
142+ id : secrets
143+ uses : SonarSource/vault-action-wrapper@v3
144+ with :
145+ secrets : |
146+ development/github/token/{REPO_OWNER_NAME_DASH}-lock token | lock_token;
147+ development/kv/data/slack token | slack_api_token;
148+ - &freeze-branch-toggle
149+ uses : sonarsource/gh-action-lt-backlog/ToggleLockBranch@v2
150+ with :
151+ github-token : ${{ fromJSON(steps.secrets.outputs.vault).lock_token }}
152+ slack-token : ${{ fromJSON(steps.secrets.outputs.vault).slack_api_token }}
153+ slack-channel : ${{ inputs.slack-channel }}
154+ branch-pattern : ${{ inputs.branch }}
155+ - name : Summary
156+ if : ${{ inputs.verbose }}
157+ shell : bash
158+ env :
159+ BRANCH : ${{ inputs.branch }}
160+ SLACK_CHANNEL : ${{ inputs.slack-channel || 'not set' }}
161+ run : |
162+ echo "## 🧊 Freeze Branch" >> $GITHUB_STEP_SUMMARY
163+ echo "" >> $GITHUB_STEP_SUMMARY
164+ echo "### What happened" >> $GITHUB_STEP_SUMMARY
165+ echo "- Locked branch pattern \`$BRANCH\` to prevent changes during the release." >> $GITHUB_STEP_SUMMARY
166+ echo "- Notifications sent to Slack channel: \`$SLACK_CHANNEL\`." >> $GITHUB_STEP_SUMMARY
167+
125168 # This step determines the release version, Jira version name, and gathers release notes.
126169 # It sets up the necessary outputs for subsequent steps.
127170 # These outputs include the release version, Jira version name, release notes, Jira release notes, and Jira release URL.
128171 prepare-release :
129172 name : Prepare Release
173+ needs : [ freeze-branch ]
130174 runs-on : ${{ inputs.runner-environment }}
131175 permissions :
132176 statuses : read
@@ -179,7 +223,6 @@ jobs:
179223 echo "- Release version: \`${{ steps.get-release-version.outputs.release-version }}\`." >> $GITHUB_STEP_SUMMARY
180224 echo "- Jira version name: \`${{ steps.get-jira-version.outputs.jira-version-name }}\`." >> $GITHUB_STEP_SUMMARY
181225
182- # Step 2: Create Release Ticket
183226 # This step creates a Jira release ticket using the prepared release information.
184227 # It outputs the release ticket key and URL for further use.
185228 create-release-ticket :
@@ -222,7 +265,6 @@ jobs:
222265 echo "- Ticket key: \`${{ steps.create-ticket.outputs.release-ticket-key }}\`." >> $GITHUB_STEP_SUMMARY
223266 echo "- Ticket link: ${{ steps.create-ticket.outputs.release-ticket-url }}" >> $GITHUB_STEP_SUMMARY
224267
225- # Step 3: Publish GitHub Release
226268 # This step publishes the GitHub release using the prepared release information and the created Jira release ticket.
227269 # It outputs the GitHub release URL for further use.
228270 publish-github-release :
@@ -261,7 +303,30 @@ jobs:
261303 echo "### Results" >> $GITHUB_STEP_SUMMARY
262304 echo "- Release page: ${{ steps.publish-github-release.outputs.release-url }}" >> $GITHUB_STEP_SUMMARY
263305
264- # Step 4: Release in Jira
306+ # This job unfreezes the specified branch after the GitHub release is published.
307+ unfreeze-branch :
308+ name : Unfreeze ${{ inputs.branch }} branch
309+ if : ${{ inputs.freeze-branch }}
310+ runs-on : ${{ inputs.runner-environment }}
311+ needs : [ publish-github-release ]
312+ permissions :
313+ id-token : write
314+ steps :
315+ - *freeze-branch-secrets
316+ - *freeze-branch-toggle
317+ - name : Summary
318+ if : ${{ inputs.verbose }}
319+ shell : bash
320+ env :
321+ BRANCH : ${{ inputs.branch }}
322+ SLACK_CHANNEL : ${{ inputs.slack-channel || 'not set' }}
323+ run : |
324+ echo "## 🔓 Unfreeze Branch" >> $GITHUB_STEP_SUMMARY
325+ echo "" >> $GITHUB_STEP_SUMMARY
326+ echo "### What happened" >> $GITHUB_STEP_SUMMARY
327+ echo "- Unlocked branch pattern \`$BRANCH\` after publishing the GitHub release." >> $GITHUB_STEP_SUMMARY
328+ echo "- Notifications sent to Slack channel: \`$SLACK_CHANNEL\`." >> $GITHUB_STEP_SUMMARY
329+
265330 # This step releases the version in Jira and moves the release ticket to the "Technical Release Done" status.
266331 # It outputs the new version name and integration ticket keys and URLs.
267332 release-in-jira :
@@ -309,7 +374,6 @@ jobs:
309374 echo "### Results" >> $GITHUB_STEP_SUMMARY
310375 echo "- New Jira version: \`${{ steps.create-jira-version.outputs.jira-new-version-name }}\`." >> $GITHUB_STEP_SUMMARY
311376
312- # Step 5: Create Integration Tickets
313377 # This step creates integration tickets in various Jira projects based on the inputs provided.
314378 # It creates tickets for SLVS, SLVSCODE, SLE, SLI, SQC, and SQS as specified.
315379 # It outputs the integration ticket keys for SQC and SQS for further use.
@@ -422,7 +486,6 @@ jobs:
422486 if [ "$SQC_INTEGRATION" = "true" ]; then echo "- SQC ticket \`${{ steps.create-sqc-ticket.outputs.ticket-key }}\` — ${{ steps.create-sqc-ticket.outputs.ticket-url }}" >> $GITHUB_STEP_SUMMARY; fi
423487 if [ "$SQS_INTEGRATION" = "true" ]; then echo "- SQS ticket \`${{ steps.create-sqs-ticket.outputs.ticket-key }}\` — ${{ steps.create-sqs-ticket.outputs.ticket-url }}" >> $GITHUB_STEP_SUMMARY; fi
424488
425- # Step 6: Update Analyzers in SQS and SQC
426489 # This step updates the analyzers in SQS and SQC by creating pull requests based on the integration tickets created in the previous step.
427490 # It outputs the pull request URLs for SQS and SQC for further use.
428491 update-analyzers :
@@ -485,7 +548,6 @@ jobs:
485548 if [ "$SQS_INTEGRATION" = "true" ]; then echo "- SQS PR: ${{ steps.update-sqs.outputs.pull-request-url }}" >> $GITHUB_STEP_SUMMARY; fi
486549 if [ "$SQC_INTEGRATION" = "true" ]; then echo "- SQC PR: ${{ steps.update-sqc.outputs.pull-request-url }}" >> $GITHUB_STEP_SUMMARY; fi
487550
488- # Step 7: Summarize Release
489551 # This step summarizes the results of the entire release process.
490552 # It checks the outcomes of all previous steps and generates a summary indicating whether the release was
491553 # successful or failed, along with relevant links and information.
0 commit comments