2017-05-13 18:09:42 -03:00
|
|
|
// Package client contains the client implementations for several providers.
|
|
|
|
package client
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
|
2018-08-14 23:50:20 -03:00
|
|
|
"github.com/goreleaser/goreleaser/pkg/config"
|
|
|
|
"github.com/goreleaser/goreleaser/pkg/context"
|
2017-05-13 18:09:42 -03:00
|
|
|
)
|
|
|
|
|
|
|
|
// Info of the repository
|
|
|
|
type Info struct {
|
|
|
|
Description string
|
|
|
|
Homepage string
|
|
|
|
URL string
|
|
|
|
}
|
|
|
|
|
|
|
|
// Client interface
|
|
|
|
type Client interface {
|
2019-06-29 16:02:40 +02:00
|
|
|
CreateRelease(ctx *context.Context, body string) (releaseID string, err error)
|
2019-06-26 14:12:33 -03:00
|
|
|
CreateFile(ctx *context.Context, commitAuthor config.CommitAuthor, repo config.Repo, content []byte, path, message string) (err error)
|
2019-06-29 16:02:40 +02:00
|
|
|
Upload(ctx *context.Context, releaseID string, name string, file *os.File) (err error)
|
|
|
|
}
|
|
|
|
|
|
|
|
// New creates a new client depending on the token type
|
|
|
|
func New(ctx *context.Context) (Client, error) {
|
|
|
|
if ctx.TokenType == context.TokenTypeGitHub {
|
|
|
|
return NewGitHub(ctx)
|
|
|
|
}
|
|
|
|
if ctx.TokenType == context.TokenTypeGitLab {
|
|
|
|
return NewGitLab(ctx)
|
|
|
|
}
|
2019-07-08 18:38:02 +02:00
|
|
|
return nil, nil
|
2017-05-13 18:09:42 -03:00
|
|
|
}
|