-
Notifications
You must be signed in to change notification settings - Fork 6
140 lines (116 loc) · 4.73 KB
/
spring-finalize-release.yml
File metadata and controls
140 lines (116 loc) · 4.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Create GH release and Notify Slack
on:
workflow_call:
inputs:
milestone:
description: 'Milestone title, e.g 3.0.0-M1, 3.1.0-RC1, 3.2.0 etc.'
required: true
type: string
secrets:
SPRING_RELEASE_CHAT_WEBHOOK_URL:
required: false
GH_ACTIONS_REPO_TOKEN:
required: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SPRING_MAIN_BANNERMODE: off
jobs:
finalize-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
show-progress: false
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 25
- name: Tag Release and Next Development Version
id: tag-release
run: |
if test -f pom.xml
then
mvn versions:set -DnewVersion=${{ inputs.milestone }} -DgenerateBackupPoms=false -DprocessAllModules=true -B -ntp
else
sed -i "s/version=.*/version=${{ inputs.milestone }}/" gradle.properties
fi
git config --global user.name 'Spring Builds'
git config --global user.email 'builds@springframework.org'
git fetch origin --no-tags
git pull origin ${{ github.ref }}
git commit -a -m "[CI/CD] Release version ${{ inputs.milestone }}"
git tag "v${{ inputs.milestone }}"
NEXT_VERSION="${{ inputs.milestone }}"
if [[ "$NEXT_VERSION" == *"-"* ]]
then
NEXT_VERSION=${NEXT_VERSION/-*}
else
MAJOR_MINOR=$(echo "$NEXT_VERSION" | cut -d '.' -f1-2)
PATCH=$(echo "$NEXT_VERSION" | cut -d '.' -f3)
PATCH=$((PATCH+1))
NEXT_VERSION=$MAJOR_MINOR.$PATCH
fi
NEXT_VERSION=${NEXT_VERSION}-SNAPSHOT
if test -f pom.xml
then
mvn versions:set -DnewVersion=$NEXT_VERSION -DgenerateBackupPoms=false -DprocessAllModules=true -B -ntp
else
sed -i "s/version=.*/version=$NEXT_VERSION/" gradle.properties
fi
git commit -a -m "[CI/CD] Next development version"
git push origin
git push --tags origin
echo nextVersion=$NEXT_VERSION >> $GITHUB_OUTPUT
- name: Changelog Config File
run: |
repositoryTeam=$(gh api repos/$GITHUB_REPOSITORY/collaborators --jq 'map(select(.role_name == "admin") | .login) | tostring')
repositoryTeam=$(sed 's/"//g' <<< ${repositoryTeam:1:-1})
repositoryVisibility=$(gh repo view --json visibility --jq .[])
repositoryVisibility=$([[ $repositoryVisibility = 'PUBLIC' ]] && echo 'true' || echo 'false')
echo "changelog.contributors.exclude.names=$repositoryTeam" > changelog.properties
echo "changelog.issues.generate-links=$repositoryVisibility" >> changelog.properties
- name: Generate Changelog
uses: spring-io/github-changelog-generator@v0.0.13
with:
milestone: ${{ inputs.milestone }}
token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
config-file: changelog.properties
- name: GitHub Release
uses: spring-io/spring-release-actions/publish-release-notes@0.0.3
with:
tag: v${{ inputs.milestone }}
- name: Close Milestone
uses: spring-io/spring-release-actions/close-milestone@0.0.3
with:
version: ${{ inputs.milestone }}
- name: Checkout Common Repo
uses: actions/checkout@v6
with:
repository: spring-io/spring-github-workflows
path: .github/spring-github-workflows
show-progress: false
- name: Update Spring IO website for new version
uses: spring-io/spring-release-actions/update-learn-page@0.0.3
with:
version: ${{ inputs.milestone }}
website-token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
- name: Announce Release in Chat
if: env.CHAT_WEBHOOK_URL
uses: spring-io/spring-release-actions/announce-on-gchat@0.0.3
with:
gchat-webhook-url: ${{ env.CHAT_WEBHOOK_URL }}
version: ${{ inputs.milestone }}
env:
CHAT_WEBHOOK_URL: ${{ secrets.SPRING_RELEASE_CHAT_WEBHOOK_URL }}
# - name: Announce Release on Slack
# uses: slackapi/slack-github-action@v1.26.0
# if: env.SLACK_WEBHOOK_URL
# env:
# SLACK_WEBHOOK_URL: ${{ secrets.SPRING_RELEASE_SLACK_WEBHOOK_URL }}
# SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
# with:
# payload: |
# {
# "text": "${{ github.event.repository.name }}-announcing `${{ inputs.milestone }}`"
# }