aboutsummaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2024-05-16 05:34:38 +0800
committerGitHub <noreply@github.com>2024-05-15 16:34:38 -0500
commit0c9dcda10d3938b80166a4cffa2854d34a0134fb (patch)
tree1e012f23d636af99cbb18fd81f7ca7d57d86a7b6 /services
parentcb52eb639e5d9b36794e46ec2e09d633c23c7322 (diff)
downloadgitea-0c9dcda10d3938b80166a4cffa2854d34a0134fb.tar.gz
gitea-0c9dcda10d3938b80166a4cffa2854d34a0134fb.zip
Check if the release is converted from the tag when updating the release (#30984) (#30986)
We should call `notify_service.NewRelease` when a release is created from an existing tag. Co-authored-by: Zettat123 <zettat123@gmail.com>
Diffstat (limited to 'services')
-rw-r--r--services/release/release.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/services/release/release.go b/services/release/release.go
index ba5fd1dd98..399fdc79c0 100644
--- a/services/release/release.go
+++ b/services/release/release.go
@@ -204,7 +204,7 @@ func UpdateRelease(ctx context.Context, doer *user_model.User, gitRepo *git.Repo
if rel.ID == 0 {
return errors.New("UpdateRelease only accepts an exist release")
}
- isCreated, err := createTag(gitRepo.Ctx, gitRepo, rel, "")
+ isTagCreated, err := createTag(gitRepo.Ctx, gitRepo, rel, "")
if err != nil {
return err
}
@@ -216,6 +216,12 @@ func UpdateRelease(ctx context.Context, doer *user_model.User, gitRepo *git.Repo
}
defer committer.Close()
+ oldRelease, err := repo_model.GetReleaseByID(ctx, rel.ID)
+ if err != nil {
+ return err
+ }
+ isConvertedFromTag := oldRelease.IsTag && !rel.IsTag
+
if err = repo_model.UpdateRelease(ctx, rel); err != nil {
return err
}
@@ -292,7 +298,7 @@ func UpdateRelease(ctx context.Context, doer *user_model.User, gitRepo *git.Repo
}
if !rel.IsDraft {
- if !isCreated {
+ if !isTagCreated && !isConvertedFromTag {
notify_service.UpdateRelease(gitRepo.Ctx, doer, rel)
return nil
}