upgrade

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNewer

func IsNewer(currentVersion, releaseVersion string) (bool, error)

IsNewer compares the release version with the current version Returns true if the release is newer than the current version

Types

type CreateReleaseRequest

type CreateReleaseRequest struct {
	TagName         string `json:"tag_name"`
	Name            string `json:"name"`
	Body            string `json:"body"`
	Draft           bool   `json:"draft"`
	Prerelease      bool   `json:"prerelease"`
	TargetCommitish string `json:"target_commitish,omitempty"`
}

CreateReleaseRequest represents a request to create a GitHub release

type GitHubClient

type GitHubClient struct {
	// contains filtered or unexported fields
}

GitHubClient handles communication with GitHub API

func NewGitHubClient

func NewGitHubClient() *GitHubClient

NewGitHubClient creates a new GitHub API client

func (*GitHubClient) CreateRelease

func (c *GitHubClient) CreateRelease(ctx context.Context, owner, repo string, release *CreateReleaseRequest) (*ReleaseInfo, error)

CreateRelease creates a new GitHub release

func (*GitHubClient) GetLatestRelease

func (c *GitHubClient) GetLatestRelease(ctx context.Context, owner, repo string) (*ReleaseInfo, error)

GetLatestRelease fetches the latest release from GitHub

type GoUpgrader

type GoUpgrader struct {
	// contains filtered or unexported fields
}

GoUpgrader handles upgrades via go install

func (*GoUpgrader) GetUpgradeCommand

func (u *GoUpgrader) GetUpgradeCommand() string

func (*GoUpgrader) Upgrade

func (u *GoUpgrader) Upgrade(ctx context.Context, release *ReleaseInfo) error

type HomebrewUpgrader

type HomebrewUpgrader struct {
	// contains filtered or unexported fields
}

HomebrewUpgrader handles upgrades via Homebrew

func (*HomebrewUpgrader) GetUpgradeCommand

func (u *HomebrewUpgrader) GetUpgradeCommand() string

func (*HomebrewUpgrader) Upgrade

func (u *HomebrewUpgrader) Upgrade(ctx context.Context, release *ReleaseInfo) error

type InstallInfo

type InstallInfo struct {
	Method     InstallMethod
	BinaryPath string
	Version    string
	Commit     string
	Date       string
	CanUpgrade bool
	Reason     string // Why it can't upgrade
}

InstallInfo contains information about the current shipyard installation

func DetectInstallation

func DetectInstallation(version, commit, date string) (*InstallInfo, error)

DetectInstallation determines how shipyard was installed

type InstallMethod

type InstallMethod int

InstallMethod represents how shipyard was installed

const (
	InstallMethodUnknown InstallMethod = iota
	InstallMethodHomebrew
	InstallMethodNPM
	InstallMethodGo
	InstallMethodScript
	InstallMethodDocker
)

func (InstallMethod) String

func (m InstallMethod) String() string

String returns the human-readable name of the install method

type NPMUpgrader

type NPMUpgrader struct {
	// contains filtered or unexported fields
}

NPMUpgrader handles upgrades via npm

func (*NPMUpgrader) GetUpgradeCommand

func (u *NPMUpgrader) GetUpgradeCommand() string

func (*NPMUpgrader) Upgrade

func (u *NPMUpgrader) Upgrade(ctx context.Context, release *ReleaseInfo) error

type ReleaseAsset

type ReleaseAsset struct {
	Name        string
	DownloadURL string
	Size        int64
}

ReleaseAsset represents a downloadable asset from a GitHub release

type ReleaseInfo

type ReleaseInfo struct {
	TagName     string
	Name        string
	Body        string
	PublishedAt time.Time
	Assets      []ReleaseAsset
	Prerelease  bool
}

ReleaseInfo contains information about a GitHub release

type ScriptUpgrader

type ScriptUpgrader struct {
	// contains filtered or unexported fields
}

ScriptUpgrader handles upgrades for script/manual installations

func (*ScriptUpgrader) GetUpgradeCommand

func (u *ScriptUpgrader) GetUpgradeCommand() string

func (*ScriptUpgrader) Upgrade

func (u *ScriptUpgrader) Upgrade(ctx context.Context, release *ReleaseInfo) error

type Upgrader

type Upgrader interface {
	Upgrade(ctx context.Context, release *ReleaseInfo) error
	GetUpgradeCommand() string
}

Upgrader defines the interface for upgrade strategies

func NewUpgrader

func NewUpgrader(info *InstallInfo, log *logger.Logger) (Upgrader, error)

NewUpgrader creates an appropriate upgrader based on installation method

Jump to

Keyboard shortcuts

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