mirror of
https://gitea.com/actions/release-action.git
synced 2025-06-08 13:56:34 +00:00
Update main.go
This commit is contained in:
parent
a45bda39c0
commit
326e08ff7c
15
main.go
15
main.go
@ -19,16 +19,14 @@ func main() {
|
|||||||
gha.Fatalf("failed to get context: %v", err)
|
gha.Fatalf("failed to get context: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !strings.HasPrefix(ctx.Ref, "refs/tags/") {
|
|
||||||
gha.Fatalf("ref %s is not a tag", ctx.Ref)
|
|
||||||
}
|
|
||||||
|
|
||||||
files := gha.GetInput("files")
|
files := gha.GetInput("files")
|
||||||
title := gha.GetInput("title")
|
title := gha.GetInput("title")
|
||||||
body := gha.GetInput("body")
|
body := gha.GetInput("body")
|
||||||
apiKey := gha.GetInput("api_key")
|
apiKey := gha.GetInput("api_key")
|
||||||
preRelease, _ := strconv.ParseBool(gha.GetInput("pre_release"))
|
preRelease, _ := strconv.ParseBool(gha.GetInput("pre_release"))
|
||||||
draft, _ := strconv.ParseBool(gha.GetInput("draft"))
|
draft, _ := strconv.ParseBool(gha.GetInput("draft"))
|
||||||
|
tagName := gha.GetInput("tag_name");
|
||||||
|
|
||||||
if title == "" {
|
if title == "" {
|
||||||
title = ctx.RefName
|
title = ctx.RefName
|
||||||
}
|
}
|
||||||
@ -36,6 +34,13 @@ func main() {
|
|||||||
apiKey = os.Getenv("GITHUB_TOKEN")
|
apiKey = os.Getenv("GITHUB_TOKEN")
|
||||||
}
|
}
|
||||||
insecure, _ := strconv.ParseBool(gha.GetInput("insecure"))
|
insecure, _ := strconv.ParseBool(gha.GetInput("insecure"))
|
||||||
|
if tagName == "" {
|
||||||
|
tagName = ctx.RefName
|
||||||
|
}
|
||||||
|
// I don't understend what this doing
|
||||||
|
// if !strings.HasPrefix(tagName, "refs/tags/") {
|
||||||
|
// gha.Fatalf("ref %s is not a tag", tagName)
|
||||||
|
// }
|
||||||
|
|
||||||
client := http.DefaultClient
|
client := http.DefaultClient
|
||||||
if insecure {
|
if insecure {
|
||||||
@ -54,7 +59,7 @@ func main() {
|
|||||||
repo := strings.Split(ctx.Repository, "/")[1]
|
repo := strings.Split(ctx.Repository, "/")[1]
|
||||||
|
|
||||||
rel, err := createOrGetRelease(ctx, c, owner, repo, gitea.CreateReleaseOption{
|
rel, err := createOrGetRelease(ctx, c, owner, repo, gitea.CreateReleaseOption{
|
||||||
TagName: ctx.RefName,
|
TagName: tagName,
|
||||||
IsDraft: draft,
|
IsDraft: draft,
|
||||||
IsPrerelease: preRelease,
|
IsPrerelease: preRelease,
|
||||||
Title: title,
|
Title: title,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user