Skip to content

Commit 6f527d9

Browse files
committed
Improve spring-artifactory-gradle-release.yml
* Add `check-if-no-opened-issues` & `check-last-snapshot-build` before starting to build release * Separate post-release actions to `post-release` job. This way the tag and GH release won't be affected if update to spring.io page or announce in chat fails
1 parent 26e007e commit 6f527d9

2 files changed

Lines changed: 63 additions & 38 deletions

File tree

.github/workflows/spring-artifactory-gradle-release.yml

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,39 @@ jobs:
8282
releaseVersion:
8383
uses: ./.github/workflows/spring-find-release-version.yml
8484

85-
staging:
85+
check-if-no-opened-issues:
8686
needs: releaseVersion
87+
name: Check is no opened issues for ${{ needs.releaseVersion.outputs.releaseVersion }}
88+
runs-on: ${{ inputs.runner }}
89+
steps:
90+
- uses: spring-io/spring-release-actions/count-open-issues@0.0.3
91+
id: count-open-issues
92+
with:
93+
milestone: ${{ needs.releaseVersion.outputs.releaseVersion }}
94+
- name: Check if no opened issues
95+
run: |
96+
if [[ ${{ steps.count-open-issues.outputs.count }} -gt 0 ]]
97+
then
98+
gh run cancel ${{ github.run_id }}
99+
echo "::warning title=Cannot release::The milestone ${{ steps.find-milestone.outputs.currentVersion }} has opened issues"
100+
fi
101+
102+
check-last-snapshot-build:
103+
needs: check-if-no-opened-issues
104+
name: Check the last SNAPSHOT build for ${{ needs.releaseVersion.outputs.releaseVersion }}
105+
runs-on: ${{ inputs.runner }}
106+
steps:
107+
- name: Check the last SNAPSHOT build is green
108+
run: |
109+
LAST_SNAPSHOT_BUILD_STATUS=$(gh run list -R ${{ github.repository }} -b ${{ github.ref_name }} -L 1 -w ci-snapshot.yml --json conclusion --jq .[0].conclusion)
110+
if [[ $LAST_SNAPSHOT_BUILD_STATUS != 'success' ]]
111+
then
112+
gh run cancel ${{ github.run_id }}
113+
echo "::warning title=Cannot release::The last SNAPSHOT build for milestone ${{ steps.find-milestone.outputs.currentVersion }} has not passed"
114+
fi
115+
116+
staging:
117+
needs: check-last-snapshot-build
87118
name: Stage ${{ needs.releaseVersion.outputs.releaseVersion }}
88119
uses: ./.github/workflows/spring-artifactory-gradle-build.yml
89120
with:
@@ -159,8 +190,37 @@ jobs:
159190
finalize:
160191
if: ${{ !(failure() || cancelled()) }}
161192
needs: [ releaseVersion, deploy-to-central, spring-release-bundle ]
162-
name: Finalize ${{ needs.releaseVersion.outputs.releaseVersion }}
193+
name: Finalize ${{ needs.releaseVersion.outputs.releaseVersion }} release
163194
uses: ./.github/workflows/spring-finalize-release.yml
164195
with:
165196
milestone: ${{ needs.releaseVersion.outputs.releaseVersion }}
166197
secrets: inherit
198+
199+
post-release:
200+
if: ${{ !(failure() || cancelled()) }}
201+
needs: [ releaseVersion, finalize ]
202+
name: Post-procedure for ${{ needs.releaseVersion.outputs.releaseVersion }} release
203+
runs-on: ${{ inputs.runner }}
204+
steps:
205+
- name: Checkout Common Repo
206+
uses: actions/checkout@v6
207+
with:
208+
repository: spring-io/spring-github-workflows
209+
path: .github/spring-github-workflows
210+
show-progress: false
211+
ref: ${{ env.WORKFLOWS_REF }}
212+
213+
- name: Update Spring IO website for new version
214+
uses: ./.github/spring-github-workflows/.github/actions/spring-website-project-version-update
215+
with:
216+
newVersion: ${{ needs.releaseVersion.outputs.releaseVersion }}
217+
token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
218+
219+
- name: Announce Release in Chat
220+
if: env.CHAT_WEBHOOK_URL
221+
uses: spring-io/spring-release-actions/announce-on-gchat@0.0.3
222+
with:
223+
gchat-webhook-url: ${{ env.CHAT_WEBHOOK_URL }}
224+
version: ${{ needs.releaseVersion.outputs.releaseVersion }}
225+
env:
226+
CHAT_WEBHOOK_URL: ${{ secrets.SPRING_RELEASE_CHAT_WEBHOOK_URL }}

.github/workflows/spring-finalize-release.yml

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -102,39 +102,4 @@ jobs:
102102
- name: Close Milestone
103103
uses: spring-io/spring-release-actions/close-milestone@0.0.3
104104
with:
105-
version: ${{ inputs.milestone }}
106-
107-
- name: Checkout Common Repo
108-
uses: actions/checkout@v6
109-
with:
110-
repository: spring-io/spring-github-workflows
111-
path: .github/spring-github-workflows
112-
show-progress: false
113-
ref: ${{ env.WORKFLOWS_REF }}
114-
115-
- name: Update Spring IO website for new version
116-
uses: ./.github/spring-github-workflows/.github/actions/spring-website-project-version-update
117-
with:
118-
newVersion: ${{ inputs.milestone }}
119-
token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
120-
121-
- name: Announce Release in Chat
122-
if: env.CHAT_WEBHOOK_URL
123-
uses: spring-io/spring-release-actions/announce-on-gchat@0.0.3
124-
with:
125-
gchat-webhook-url: ${{ env.CHAT_WEBHOOK_URL }}
126-
version: ${{ inputs.milestone }}
127-
env:
128-
CHAT_WEBHOOK_URL: ${{ secrets.SPRING_RELEASE_CHAT_WEBHOOK_URL }}
129-
130-
# - name: Announce Release on Slack
131-
# uses: slackapi/slack-github-action@v1.26.0
132-
# if: env.SLACK_WEBHOOK_URL
133-
# env:
134-
# SLACK_WEBHOOK_URL: ${{ secrets.SPRING_RELEASE_SLACK_WEBHOOK_URL }}
135-
# SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
136-
# with:
137-
# payload: |
138-
# {
139-
# "text": "${{ github.event.repository.name }}-announcing `${{ inputs.milestone }}`"
140-
# }
105+
version: ${{ inputs.milestone }}

0 commit comments

Comments
 (0)