Add change to update release ID field to id.

This commit is contained in:
GRMrGecko 2024-10-12 16:04:43 -05:00
parent 886da1fce3
commit 8d1923705a
3 changed files with 9 additions and 2 deletions

View File

@ -33,6 +33,11 @@ func (a *AddReleaseCmd) Run() error {
return err return err
} }
// Update old releases to include the ID field.
for i, release := range manifest.Releases {
manifest.Releases[i].ID = release.ReleaseID
}
// Read metadata from goreleaser. // Read metadata from goreleaser.
metadata, err := readMetadataFile(filepath.Join(a.Release, "metadata.json")) metadata, err := readMetadataFile(filepath.Join(a.Release, "metadata.json"))
if err != nil { if err != nil {
@ -94,6 +99,7 @@ func (a *AddReleaseCmd) Run() error {
// Make the release. // Make the release.
manifest.LastReleaseID++ manifest.LastReleaseID++
release := &HttpRelease{ release := &HttpRelease{
ID: manifest.LastReleaseID,
ReleaseID: manifest.LastReleaseID, ReleaseID: manifest.LastReleaseID,
Name: metadata.Name, Name: metadata.Name,
TagName: metadata.Version, TagName: metadata.Version,

View File

@ -82,7 +82,7 @@ func TestAppFunctionality(t *testing.T) {
hfun.Write(d) hfun.Write(d)
sum := hfun.Sum(nil) sum := hfun.Sum(nil)
hash := hex.EncodeToString(sum) hash := hex.EncodeToString(sum)
if hash != "01240af1d189ea540418903e15eb3068" { if hash != "19a3a502913252635b3e0ea838846197" {
t.Errorf("hash isn't valid for manifest file: %s", hash) t.Errorf("hash isn't valid for manifest file: %s", hash)
} }
@ -187,7 +187,7 @@ func TestAppFunctionality(t *testing.T) {
hfun.Write(d) hfun.Write(d)
sum = hfun.Sum(nil) sum = hfun.Sum(nil)
hash = hex.EncodeToString(sum) hash = hex.EncodeToString(sum)
if hash != "dfac4ec2fc35bb04c8f5f79e057dfbe9" { if hash != "999c4156c2b5ff25f3491b86c8255cb5" {
t.Errorf("hash isn't valid for manifest file: %s", hash) t.Errorf("hash isn't valid for manifest file: %s", hash)
} }

View File

@ -17,6 +17,7 @@ type HttpAsset struct {
// An individual release. // An individual release.
type HttpRelease struct { type HttpRelease struct {
ID int64 `yaml:"id"`
ReleaseID int64 `yaml:"release_id"` ReleaseID int64 `yaml:"release_id"`
Name string `yaml:"name"` Name string `yaml:"name"`
TagName string `yaml:"tag_name"` TagName string `yaml:"tag_name"`