@@ -407,17 +407,27 @@ async function updateLTS(versions: Versions, withGraphs?: boolean): Promise<void
407
407
const current = versions [ lang ] . current ;
408
408
409
409
// no ongoing release for this client, nothing changes
410
- if ( ! next || next === current ) {
410
+ if ( ! next || current === next ) {
411
411
continue ;
412
412
}
413
413
414
414
if ( current in supportedVersions ) {
415
- if ( versions [ lang ] . releaseType !== 'major' ) {
416
- // In the same major, the current version enters in maintenance mode, and the next become the new active
417
- delete supportedVersions [ current ] . active ;
415
+ // when we release a new patch, the current version isn't maintained anymore, as we only provide SLA for the latest minor/previous major
416
+ const nextMinor = next . match ( / .+ \. ( .+ ) \. .* / ) ;
417
+ const currentMinor = current . match ( / .+ \. ( .+ ) \. .* / ) ;
418
+
419
+ if ( ! currentMinor || ! nextMinor ) {
420
+ throw new Error ( `unable to determine minor versions: ${ currentMinor } , ${ nextMinor } ` ) ;
418
421
}
419
422
420
- supportedVersions [ current ] . maintenance = end . toISOString ( ) . split ( 'T' ) [ 0 ] ;
423
+ if ( versions [ lang ] . releaseType !== 'major' && currentMinor [ 1 ] === nextMinor [ 1 ] ) {
424
+ delete supportedVersions [ current ] ;
425
+ } else {
426
+ delete supportedVersions [ current ] . active ;
427
+
428
+ // any other release cases make the previous version enter in maintenance
429
+ supportedVersions [ current ] . maintenance = start . toISOString ( ) . split ( 'T' ) [ 0 ] ;
430
+ }
421
431
}
422
432
423
433
supportedVersions [ next ] = {
@@ -428,7 +438,7 @@ async function updateLTS(versions: Versions, withGraphs?: boolean): Promise<void
428
438
429
439
for ( const [ supportedVersion , dates ] of Object . entries ( supportedVersions ) ) {
430
440
// The support has expired, we can drop it
431
- if ( 'maintenance' in dates && new Date ( dates . maintenance as string ) < start ) {
441
+ if ( 'maintenance' in dates && new Date ( dates . end as string ) < start ) {
432
442
delete supportedVersions [ supportedVersion ] ;
433
443
434
444
continue ;
@@ -476,7 +486,6 @@ async function createReleasePR(): Promise<void> {
476
486
commits : validCommits ,
477
487
} ) ;
478
488
479
- await updateLTS ( versions , true ) ;
480
489
const versionChanges = getVersionChangesText ( versions ) ;
481
490
482
491
console . log ( 'Creating changelogs for all languages...' ) ;
@@ -514,6 +523,8 @@ async function createReleasePR(): Promise<void> {
514
523
console . log ( 'Updating config files...' ) ;
515
524
await updateAPIVersions ( versions , changelog ) ;
516
525
526
+ await updateLTS ( versions , true ) ;
527
+
517
528
const headBranch = `chore/prepare-release-${ TODAY } ` ;
518
529
console . log ( `Switching to branch: ${ headBranch } ` ) ;
519
530
if ( await gitBranchExists ( headBranch ) ) {
0 commit comments