chore: bump sdk to v1.5.0

This commit is contained in:
Louis Seubert 2026-09-13 18:57:17 +02:00
commit 5a37d05e67
Signed by: louis9902
GPG key ID: 4B9DB28F826553BD
6 changed files with 14 additions and 31 deletions

1
.dockerignore Normal file
View file

@ -0,0 +1 @@
.git

View file

@ -7,7 +7,7 @@ WORKDIR /app
COPY go.mod go.sum /app/
RUN go mod download
COPY *.go /app/
COPY . /app/
RUN go build -o app .
FROM docker.io/alpine:3.22

View file

@ -6,11 +6,11 @@ import (
"encoding/json"
"fmt"
"io"
"mime"
"mime/multipart"
"net/http"
"os"
"strings"
"code.geekeey.de/actions/sdk"
)
type ApiClient interface {
@ -43,24 +43,6 @@ func NewGitHub(client ApiClient) *GitHub {
return &GitHub{client: client}
}
func HasContentType(r *http.Response, mimetype string) bool {
contentType := r.Header.Get("content-type")
if contentType == "" {
return mimetype == "application/octet-stream"
}
for _, v := range strings.Split(contentType, ",") {
t, _, err := mime.ParseMediaType(v)
if err != nil {
break
}
if t == mimetype {
return true
}
}
return false
}
type GitTag struct {
Commit struct {
Created string `json:"created,omitempty"`
@ -87,7 +69,7 @@ func (gh *GitHub) GetGitTagInfo(repository, tag string, ctx context.Context) (*G
return nil, err
}
defer res.Body.Close()
if !HasContentType(res, "application/json") {
if !sdk.HasContentType(res, "application/json") {
return nil, fmt.Errorf("content-type: %q should be %q",
res.Header.Get("content-type"), "application/json")
}
@ -161,7 +143,7 @@ func (gh *GitHub) CreateRelease(creq *CreateReleaseRequest, ctx context.Context)
return nil, err
}
defer res.Body.Close()
if !HasContentType(res, "application/json") {
if !sdk.HasContentType(res, "application/json") {
return nil, fmt.Errorf("content-type: %q should be %q",
res.Header.Get("content-type"), "application/json")
}
@ -264,7 +246,7 @@ func (gh *GitHub) CreateReleaseArtifact(creq *CreateReleaseArtifactRequest, ctx
return nil, err
}
defer res.Body.Close()
if !HasContentType(res, "application/json") {
if !sdk.HasContentType(res, "application/json") {
return nil, fmt.Errorf("content-type: %q should be %q",
res.Header.Get("content-type"), "application/json")
}

2
go.mod
View file

@ -2,4 +2,4 @@ module code.geekeey.de/actions/release
go 1.23.2
require code.geekeey.de/actions/sdk v1.2.0
require code.geekeey.de/actions/sdk v1.5.0

4
go.sum
View file

@ -1,2 +1,2 @@
code.geekeey.de/actions/sdk v1.2.0 h1:qQvOdTBtZVpR1xATNnApeiW78y34Jh83OjsQg1ajPjA=
code.geekeey.de/actions/sdk v1.2.0/go.mod h1:7iIOi3YUmdDe2BCz9s59wK1t0Ckec34e664q+TOreiE=
code.geekeey.de/actions/sdk v1.5.0 h1:7Ly8QsBniiwDVbv2Gm14l28+ccK1Z9fVUqsPHw9lSMg=
code.geekeey.de/actions/sdk v1.5.0/go.mod h1:7iIOi3YUmdDe2BCz9s59wK1t0Ckec34e664q+TOreiE=

View file

@ -39,8 +39,6 @@ type ReleaseAction struct {
}
func (action *ReleaseAction) setup() error {
var err error
action.repository = action.GetInput("repository")
if ok, err := regexp.MatchString(`^(\w+)/(\w+)$`, action.repository); !ok || err != nil {
return fmt.Errorf("input 'repository': is empty or does not match <onwer>/<repo>")
@ -69,17 +67,19 @@ func (action *ReleaseAction) setup() error {
// draft might be a bool constant or a regex which determins if it is
// a draft by matching against the input version
action.draft, err = pattern("draft")
draft, err := pattern("draft")
if err != nil {
return fmt.Errorf("input 'draft': is not a bool or a valid regex")
}
action.draft = draft
// prerelease might be a bool constant or a regex which determins if it is
// a prelease by matching against the input version
action.prerelease, err = pattern("prerelease")
prerelease, err := pattern("prerelease")
if err != nil {
return fmt.Errorf("input 'prerelease': is not a bool or a valid regex")
}
action.prerelease = prerelease
action.label = action.GetInput("label")
action.notes = action.GetInput("notes")