-
Notifications
You must be signed in to change notification settings - Fork 1
136 lines (114 loc) · 4.97 KB
/
spring-finalize-release.yml
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
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:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SPRING_MAIN_BANNERMODE: off
jobs:
finalize-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
show-progress: false
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- 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 commit -a -m "[artifactory-release] Release version ${{ inputs.milestone }}"
git tag "v${{ inputs.milestone }}"
git push --tags origin
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 "[artifactory-release] Next development version"
git push 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.11
with:
milestone: ${{ inputs.milestone }}
token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
config-file: changelog.properties
- name: GitHub Release
run: |
RELEASE_URL=$(gh release create v${{ inputs.milestone }} -F changelog.md ${{ (contains(inputs.milestone, '-M') || contains(inputs.milestone, '-RC')) && '--prerelease' || '' }})
echo "::notice title=Release Page::$RELEASE_URL"
- name: Close Milestone
run: |
MILESTONE_ID=$(gh api repos/$GITHUB_REPOSITORY/milestones --jq '.[] | select(.title == "${{ inputs.milestone }}") | .number')
if [ $MILESTONE_ID ]; then
gh api -X PATCH repos/$GITHUB_REPOSITORY/milestones/$MILESTONE_ID -f state='closed' --silent
fi
- name: Checkout Common Repo
uses: actions/checkout@v4
with:
repository: spring-io/spring-github-workflows
path: spring-github-workflows
show-progress: false
- name: Update Spring IO website for new version
uses: ./spring-github-workflows/.github/actions/spring-website-project-version-update
with:
newVersion: ${{ inputs.milestone }}
token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
- name: Announce Release in Chat
if: env.CHAT_WEBHOOK_URL
run: |
curl -X POST '${{ env.CHAT_WEBHOOK_URL }}' -H 'Content-Type: application/json' -d '{ text: "${{ github.event.repository.name }}-announcing `${{ 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 }}`"
# }