Skip to content

Commit 1fabe50

Browse files
Lock branch during IDE releases
1 parent 16fbf4a commit 1fabe50

File tree

1 file changed

+38
-5
lines changed

1 file changed

+38
-5
lines changed

.github/workflows/ide-automated-release.yml

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ on:
3939
required: false
4040
type: string
4141
default: 'N/A'
42+
slack-channel:
43+
description: "Slack channel to notify about the release"
44+
required: false
45+
type: string
46+
default: 'squad-ide-slcore-bots'
4247

4348
outputs:
4449
new-version:
@@ -49,9 +54,21 @@ on:
4954
value: ${{ jobs.prepare-release.outputs.release-version }}
5055

5156
jobs:
57+
freeze-branch:
58+
runs-on: github-ubuntu-latest-s
59+
permissions:
60+
id-token: write
61+
steps:
62+
- uses: SonarSource/release-github-actions/lock-branch@v1
63+
with:
64+
branch: ${{ inputs.branch }}
65+
freeze: true
66+
slack-channel: ${{ inputs.slack-channel }}
67+
5268
prepare-release:
5369
name: Prepare release
5470
runs-on: github-ubuntu-latest-s
71+
needs: freeze-branch
5572
permissions:
5673
statuses: read
5774
contents: read
@@ -90,7 +107,7 @@ jobs:
90107
create-release-ticket:
91108
name: Create release ticket
92109
runs-on: github-ubuntu-latest-s
93-
needs: prepare-release
110+
needs: [freeze-branch, prepare-release]
94111
permissions:
95112
statuses: read
96113
contents: read
@@ -114,7 +131,7 @@ jobs:
114131
publish-github-release:
115132
name: Publish github release
116133
runs-on: github-ubuntu-latest-s
117-
needs: [ prepare-release, create-release-ticket ]
134+
needs: [ freeze-branch, prepare-release, create-release-ticket ]
118135
permissions:
119136
id-token: write
120137
contents: write
@@ -134,7 +151,7 @@ jobs:
134151
release-in-jira:
135152
name: Release in Jira
136153
runs-on: github-ubuntu-latest-s
137-
needs: [ prepare-release, publish-github-release, create-release-ticket ]
154+
needs: [ freeze-branch, prepare-release, publish-github-release, create-release-ticket ]
138155
permissions:
139156
statuses: read
140157
contents: read
@@ -160,18 +177,34 @@ jobs:
160177
status: "Technical Release Done"
161178
assignee: ${{ inputs.pm-email }} # TODO take it from vault
162179

180+
unfreeze-branch:
181+
needs: [ freeze-branch, prepare-release, publish-github-release, create-release-ticket, release-in-jira ]
182+
# keep branch frozen if the release failed, we need to fix something before allowing merges.
183+
# the branch can be unfrozen manually with breakglass if needed.
184+
# if: always()
185+
runs-on: github-ubuntu-latest-s
186+
permissions:
187+
id-token: write
188+
steps:
189+
- uses: SonarSource/release-github-actions/lock-branch@v1
190+
with:
191+
branch: ${{ inputs.branch }}
192+
freeze: false
193+
slack-channel: ${{ inputs.slack-channel }}
194+
163195
summarize_release:
164196
name: Release
165197
runs-on: github-ubuntu-latest-s
166198
if: always()
167-
needs: [ prepare-release, publish-github-release, create-release-ticket, release-in-jira ]
199+
needs: [ freeze-branch, prepare-release, publish-github-release, create-release-ticket, release-in-jira, unfreeze-branch ]
168200
steps:
169201
- name: Post Summary to Workflow
170202
run: |
171203
ALL_SUCCESS=$([[ "${{ needs.prepare-release.result }}" == "success" && \
172204
"${{ needs.publish-github-release.result }}" == "success" && \
173205
"${{ needs.create-release-ticket.result }}" == "success" && \
174-
"${{ needs.release-in-jira.result }}" == "success" ]] && echo "true" || echo "false")
206+
"${{ needs.release-in-jira.result }}" == "success" && \
207+
"${{ needs.unfreeze-branch.result }}" == "success" ]] && echo "true" || echo "false")
175208
176209
if [[ "$ALL_SUCCESS" == "true" ]]; then
177210
echo "### 🎉🚀 Congratulations! Release Successful! 🚀🎉" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)