releaser

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2025 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL    *url.URL
	CmdName    string
	HTTPClient HTTPDoer
	Headers    map[string]string // Optional headers to add to each request
}

Client holds the base URL, command name, allows custom HTTP client, and optional headers.

func NewClient

func NewClient(baseURL *url.URL, cmdName string, opts ...Option) *Client

NewClient creates a new Client with optional configuration.

func (*Client) FetchRelease

func (c *Client) FetchRelease(m Manifest) (FileReader, error)

FetchRelease fetches the release file for the given version and platform.

func (*Client) GetLatestVersion

func (c *Client) GetLatestVersion(plat Platform) (Manifest, error)

GetLatestVersion fetches and decodes the manifest for the given platform.

type FileReader

type FileReader struct {
	FileName string
	// contains filtered or unexported fields
}

func (FileReader) Close

func (f FileReader) Close() error

func (FileReader) Read

func (f FileReader) Read(p []byte) (n int, err error)

type HTTPDoer

type HTTPDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPDoer is an interface for http.Client or mocks.

type Manifest

type Manifest struct {
	Name    string  `json:"name"`
	Version Version `json:"version"`
	Sha256  []byte  `json:"sha256"`
}

func CreateRelease

func CreateRelease(inputPath string, platform Platform, version Version, outputDir string) (Manifest, error)

CreateRelease creates a release manifest and copies the input file to the output directory.

type Option

type Option func(*Client)

Option is a functional option for configuring Client.

func WithHTTPClient

func WithHTTPClient(client HTTPDoer) Option

WithHTTPClient sets a custom HTTP client for the Client.

func WithHeaders

func WithHeaders(headers map[string]string) Option

WithHeaders sets custom headers for the Client.

type Platform

type Platform struct {
	OS   string
	Arch string
}

func MustParse

func MustParse(s string) Platform

func NewPlatform

func NewPlatform(os string, arch string) Platform

func Parse

func Parse(s string) (Platform, error)

Parse parses a string like "linux-amd64" into a Platform struct.

func (*Platform) Set

func (p *Platform) Set(s string) error

Set parses and sets the platform from a string like "linux-amd64" Used for flag.Value interface

func (Platform) String

func (p Platform) String() string

String returns the platform as "os-arch"

type Version

type Version string

func (Version) Equals

func (v Version) Equals(other Version) bool

func (Version) String

func (v Version) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL