Skip to content

Commit

Permalink
Do not duplicate release info in releases.json when re-creating a r…
Browse files Browse the repository at this point in the history
…elease (#1207)
  • Loading branch information
AndiDog authored Jan 28, 2025
1 parent 961d07b commit 0c4e756
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Do not duplicate release info in `releases.json` when re-creating a release

## [7.1.1] - 2025-01-23

### Fixed
Expand Down
6 changes: 6 additions & 0 deletions pkg/release/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"os"
"path/filepath"
"slices"
"sort"
"strings"
"time"
Expand Down Expand Up @@ -183,6 +184,11 @@ func CreateRelease(name, base, releases, provider string, components, apps []str
IsStable: true,
}

// Replace if it's already there
releasesJson.Releases = slices.DeleteFunc(releasesJson.Releases, func(releaseJson ReleaseJsonInfo) bool {
return releaseJson.Version == newReleaseInfo.Version
})

releasesJson.Releases = append(releasesJson.Releases, newReleaseInfo)

// sort releases in json by version
Expand Down

0 comments on commit 0c4e756

Please sign in to comment.