@@ -45,6 +45,10 @@ const (
45
45
superseded = ":recycle: Superseded or Reverted"
46
46
)
47
47
48
+ const (
49
+ warningTemplate = ":rotating_light: This is a %s. Use it only for testing purposes. If you find any bugs, file an [issue](https://github.com/metal3-io/baremetal-operator/issues/new/).\n \n "
50
+ )
51
+
48
52
var (
49
53
outputOrder = []string {
50
54
warning ,
@@ -85,6 +89,14 @@ func lastTag() string {
85
89
return string (bytes .TrimSpace (out ))
86
90
}
87
91
92
+ func isBeta (tag string ) bool {
93
+ return strings .Contains (tag , "-beta." )
94
+ }
95
+
96
+ func isRC (tag string ) bool {
97
+ return strings .Contains (tag , "-rc." )
98
+ }
99
+
88
100
func firstCommit () string {
89
101
cmd := exec .Command ("git" , "rev-list" , "--max-parents=0" , "HEAD" )
90
102
out , err := cmd .Output ()
@@ -97,7 +109,7 @@ func firstCommit() string {
97
109
func run () int {
98
110
lastTag := lastTag ()
99
111
latestTag := latestTag ()
100
- cmd := exec .Command ("git" , "rev-list" , lastTag + "..HEAD" , "--merges" , "--pretty=format:%B" )
112
+ cmd := exec .Command ("git" , "rev-list" , lastTag + "..HEAD" , "--merges" , "--pretty=format:%B" ) // #nosec G204:gosec
101
113
102
114
merges := map [string ][]string {
103
115
features : {},
@@ -174,12 +186,15 @@ func run() int {
174
186
merges [key ] = append (merges [key ], formatMerge (body , prNumber ))
175
187
}
176
188
177
- // Add empty superseded section
178
- merges [superseded ] = append (merges [superseded ], "- `<insert superseded bumps and reverts here>`" )
189
+ // Add empty superseded section, if not beta/rc, we don't cleanup those notes
190
+ if ! isBeta (latestTag ) && ! isRC (latestTag ) {
191
+ merges [superseded ] = append (merges [superseded ], "- `<insert superseded bumps and reverts here>`" )
192
+ }
179
193
180
194
// TODO Turn this into a link (requires knowing the project name + organization)
181
195
fmt .Printf ("Changes since %v\n ---\n " , lastTag )
182
196
197
+ // print the changes by category
183
198
for _ , key := range outputOrder {
184
199
mergeslice := merges [key ]
185
200
if len (mergeslice ) > 0 {
@@ -189,10 +204,29 @@ func run() int {
189
204
}
190
205
fmt .Println ()
191
206
}
207
+
208
+ // if we're doing beta/rc, print breaking changes and hide the rest of the changes
209
+ if key == warning {
210
+ if isBeta (latestTag ) {
211
+ fmt .Printf (warningTemplate , "BETA RELEASE" )
212
+ }
213
+ if isRC (latestTag ) {
214
+ fmt .Printf (warningTemplate , "RELEASE CANDIDATE" )
215
+ }
216
+ if isBeta (latestTag ) || isRC (latestTag ) {
217
+ fmt .Printf ("<details>\n " )
218
+ fmt .Printf ("<summary>More details about the release</summary>\n \n " )
219
+ }
220
+ }
221
+ }
222
+
223
+ // then close the details if we had it open
224
+ if isBeta (latestTag ) || isRC (latestTag ) {
225
+ fmt .Printf ("</details>\n \n " )
192
226
}
193
227
194
- fmt .Printf ("The container image for this release is: %v\n " , latestTag )
195
- fmt .Println ("\n Thanks to all our contributors! 😊" )
228
+ fmt .Printf ("The image for this release is: %v\n " , latestTag )
229
+ fmt .Println ("\n _Thanks to all our contributors!_ 😊" )
196
230
197
231
return 0
198
232
}
0 commit comments