Add tag var

This commit is contained in:
Braydon 2023-08-06 01:28:43 -04:00
parent 23a38ad334
commit a648b05cf8

10
main.go

@ -18,9 +18,13 @@ func main() {
if err != nil { if err != nil {
gha.Fatalf("failed to get context: %v", err) gha.Fatalf("failed to get context: %v", err)
} }
tag := gha.GetInput("tag")
if tag == "" {
tag = ctx.Ref
}
if !strings.HasPrefix(ctx.Ref, "refs/tags/") { if !strings.HasPrefix(tag, "refs/tags/") {
gha.Fatalf("ref %s is not a tag", ctx.Ref) gha.Fatalf("ref %s is not a tag", tag)
} }
files := gha.GetInput("files") files := gha.GetInput("files")
@ -54,7 +58,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: tag,
IsDraft: draft, IsDraft: draft,
IsPrerelease: preRelease, IsPrerelease: preRelease,
Title: title, Title: title,