-
-
Notifications
You must be signed in to change notification settings - Fork 200
222 lines (195 loc) · 8.16 KB
/
maven-central.yml
File metadata and controls
222 lines (195 loc) · 8.16 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
name: Maven Central
on:
release:
types: [created]
jobs:
release:
name: Release on Sonatype OSS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: 21
distribution: 'temurin'
cache: maven
- name: Setup gradle.properties
env:
GRADLE_PROPERTIES: ${{ secrets.GRADLE_PROPERTIES }}
shell: bash
run: |
mkdir -p ~/.gradle/
echo "GRADLE_USER_HOME=${HOME}/.gradle" >> $GITHUB_ENV
echo "${GRADLE_PROPERTIES}" > ~/.gradle/gradle.properties
- name: Build
run: mvn clean install -DskipTests -q
- name: Set up Maven Central
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'
server-id: central
server-username: CENTRAL_USERNAME
server-password: CENTRAL_TOKEN
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Publish to Maven Central
run: mvn -pl '!tests' clean deploy -P bom,central,gradlePlugin
env:
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
CENTRAL_TOKEN: ${{ secrets.CENTRAL_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
update-release-notes:
name: Update GitHub Release Notes
needs: release
runs-on: ubuntu-latest
permissions:
contents: write
issues: write # Required to update/close milestones
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate and Update Release Notes
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
CURRENT_TAG=${{ github.ref_name }}
VERSION_NUM=${CURRENT_TAG#v}
# Calculate previous tag using version sorting
git fetch --tags --force
PREV_TAG=$(git tag --sort=-v:refname | grep -A 1 "^${CURRENT_TAG}$" | tail -n 1)
# Fetch milestone ID for the link
MILESTONE_ID=$(gh api repos/${{ github.repository }}/milestones -q ".[] | select(.title==\"$VERSION_NUM\") | .number")
# 1. Fetch BREAKING changes
gh issue list \
--repo ${{ github.repository }} \
--search "milestone:\"$VERSION_NUM\" label:break-change" \
--state all \
--limit 100 \
--json title,number \
--jq '.[] | "- \(.title) #\(.number)"' > breaking_issues.md
# 2. Fetch NEW features
gh issue list \
--repo ${{ github.repository }} \
--search "milestone:\"$VERSION_NUM\" label:feature -label:break-change" \
--state all \
--limit 100 \
--json title,number \
--jq '.[] | "- \(.title) #\(.number)"' > new_issues.md
# 3. Fetch DEPRECATED changes
gh issue list \
--repo ${{ github.repository }} \
--search "milestone:\"$VERSION_NUM\" label:deprecated -label:break-change" \
--state all \
--limit 100 \
--json title,number \
--jq '.[] | "- \(.title) #\(.number)"' > deprecated_issues.md
# 4. Fetch OTHER changes
gh issue list \
--repo ${{ github.repository }} \
--search "milestone:\"$VERSION_NUM\" -label:feature -label:break-change -label:deprecated -label:dependencies" \
--state all \
--limit 100 \
--json title,number \
--jq '.[] | "- \(.title) #\(.number)"' > other_issues.md
# 4.5 Fetch Component Summary (Group, Count, and Link Labels)
# We grab labels and issue numbers, filter structural labels, group them,
# count them, join the issue numbers, and output a Markdown table.
gh issue list \
--repo ${{ github.repository }} \
--search "milestone:\"$VERSION_NUM\"" \
--state all \
--limit 1000 \
--json number,labels \
--jq '
[ .[] as $issue | $issue.labels[].name |
select(. != "bug" and . != "enhancement" and . != "feature" and . != "feedback" and . != "break-change" and . != "api-change" and . != "dependencies" and . != "deprecated") |
{name: ., number: $issue.number} ] |
group_by(.name) |
map({
name: .[0].name,
count: length,
issues: map("#\(.number)") | join(", ")
}) |
sort_by(-.count) |
if length > 0 then
"| Component | Count | Issues |\n|---|---|---|\n" + (map("| \(.name) | \(.count) | \(.issues) |") | join("\n"))
else
empty
end
' > label_summary.md
# 5. Initialize the changelog file
> changelog.md
# 6. Conditionally add "Breaking Changes"
if [ -s breaking_issues.md ]; then
echo "## ⚠️ Breaking Changes" >> changelog.md
echo "" >> changelog.md
cat breaking_issues.md >> changelog.md
echo "" >> changelog.md
fi
# 7. Conditionally add "What's New"
if [ -s new_issues.md ]; then
echo "## 🚀 What's New" >> changelog.md
echo "" >> changelog.md
cat new_issues.md >> changelog.md
echo "" >> changelog.md
fi
# 7.5 Conditionally add "Component Summary" Table
if [ -s label_summary.md ]; then
echo "## 📊 Component Updates" >> changelog.md
echo "" >> changelog.md
cat label_summary.md >> changelog.md
echo "" >> changelog.md
fi
# 8. Conditionally add "Other Changes"
if [ -s other_issues.md ]; then
echo "## 🛠️ Changes" >> changelog.md
echo "" >> changelog.md
cat other_issues.md >> changelog.md
echo "" >> changelog.md
fi
# 9. Conditionally add "Deprecated"
if [ -s deprecated_issues.md ]; then
echo "## 🗑️ Deprecated" >> changelog.md
echo "" >> changelog.md
cat deprecated_issues.md >> changelog.md
echo "" >> changelog.md
fi
# 10. Build the rest of the changelog (Links & Sponsors)
cat << EOF >> changelog.md
## 🔗 Links & Resources
- [$CURRENT_TAG](https://github.com/jooby-project/jooby/tree/$CURRENT_TAG)
- [Closed Issues](https://github.com/jooby-project/jooby/milestone/$MILESTONE_ID?closed=1)
- [Changelog](https://github.com/jooby-project/jooby/compare/$PREV_TAG...$CURRENT_TAG)
- [Dependency Updates](https://github.com/jooby-project/jooby/pulls?q=is%3Apr+label%3Adependencies+is%3Aclosed+milestone%3A$VERSION_NUM)
## 💖 Support my work
- [Sponsor Jooby](https://github.com/sponsors/jknack)
### 🏆 Sponsors
- [@premium-minds](https://github.com/premium-minds)
- [@agentgt](https://github.com/agentgt)
- [@tipsy](https://github.com/tipsy)
EOF
# Overwrite the existing release notes
gh release edit $CURRENT_TAG --notes-file changelog.md
- name: Close Milestone
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
CURRENT_TAG=${{ github.ref_name }}
VERSION_NUM=${CURRENT_TAG#v}
# Fetch the ID of the milestone only if it is currently open
MILESTONE_ID=$(gh api repos/${{ github.repository }}/milestones -q ".[] | select(.title==\"$VERSION_NUM\" and .state==\"open\") | .number")
if [ -n "$MILESTONE_ID" ]; then
echo "Closing milestone $VERSION_NUM (ID: $MILESTONE_ID)..."
gh api \
--method PATCH \
-H "Accept: application/vnd.github+json" \
repos/${{ github.repository }}/milestones/$MILESTONE_ID \
-f state='closed'
echo "Milestone closed successfully."
else
echo "No open milestone found matching version $VERSION_NUM. Skipping."
fi