workflow

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Package workflow orchestrates the APK publishing workflow.

Index

Constants

This section is empty.

Variables

View Source
var ErrNothingToDo = fmt.Errorf("nothing to do")

ErrNothingToDo indicates no publishing is needed.

Functions

func OutputEvents

func OutputEvents(events *nostr.EventSet)

OutputEvents prints events as formatted, colorized JSON.

func OutputEventsToStdout added in v0.3.1

func OutputEventsToStdout(events *nostr.EventSet)

OutputEventsToStdout outputs events as newline-delimited JSON to stdout. This format is suitable for piping to tools like `nak event`.

func OutputUploadManifest added in v0.3.1

func OutputUploadManifest(entries []UploadManifestEntry, blossomServer string)

OutputUploadManifest outputs the upload manifest to stderr.

func ResolveURLsWithoutUpload

func ResolveURLsWithoutUpload(ctx context.Context, cfg *config.Config, apkInfo *apk.APKInfo, blossomURL string, preDownloaded *PreDownloadedImages, opts *cli.Options) (iconURL string, imageURLs []string, err error)

ResolveURLsWithoutUpload computes Blossom URLs by downloading/reading files and computing hashes, but without actually uploading to Blossom. Used for offline and npub modes.

func UploadAndSignWithBatch

func UploadAndSignWithBatch(ctx context.Context, params UploadParams) (*nostr.EventSet, error)

UploadAndSignWithBatch handles uploads and signing when using a batch signer.

func UploadWithIndividualSigning

func UploadWithIndividualSigning(ctx context.Context, params UploadParams) (iconURL string, imageURLs []string, err error)

UploadWithIndividualSigning handles uploads with regular signers.

func WithSpinner

func WithSpinner[T any](opts *cli.Options, message string, fn func() (T, error)) (T, error)

WithSpinner executes a function with spinner feedback. Returns the result and any error from the function.

func WithSpinnerMsg

func WithSpinnerMsg(opts *cli.Options, message string, fn func() error, successMsg func(error) string) error

WithSpinnerMsg executes a function with spinner feedback and custom success message.

Types

type DownloadedImage

type DownloadedImage struct {
	URL      string // Original URL
	Data     []byte // Image bytes
	Hash     string // SHA256 hash (hex)
	MimeType string // MIME type
}

DownloadedImage holds pre-downloaded image data.

type PreDownloadedImages

type PreDownloadedImages struct {
	Icon   *DownloadedImage   // Icon (from cfg.Icon if remote URL)
	Images []*DownloadedImage // Screenshots (from cfg.Images if remote URLs)
}

PreDownloadedImages holds all pre-downloaded images for a release.

func PreDownloadImages

func PreDownloadImages(ctx context.Context, cfg *config.Config, opts *cli.Options) (*PreDownloadedImages, error)

PreDownloadImages downloads cfg.Icon and cfg.Images if they are remote URLs.

type Publisher

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

Publisher orchestrates the APK publishing workflow.

func NewPublisher

func NewPublisher(opts *cli.Options, cfg *config.Config) (*Publisher, error)

NewPublisher creates a new publish workflow.

func (*Publisher) Close

func (p *Publisher) Close()

Close releases resources.

func (*Publisher) Execute

func (p *Publisher) Execute(ctx context.Context) error

Execute runs the complete publish workflow.

type UploadManifestEntry added in v0.3.1

type UploadManifestEntry struct {
	Description string // Human-readable description (e.g., "APK", "Icon", "Screenshot 1")
	FilePath    string // Local file path or "(from APK)" for extracted data
	SHA256      string // SHA256 hash of the file
	BlossomURL  string // Expected Blossom URL
}

UploadManifestEntry represents a file that must be uploaded to Blossom.

type UploadParams

type UploadParams struct {
	Cfg                 *config.Config
	APKInfo             *apk.APKInfo
	APKPath             string
	Release             *source.Release
	Client              *blossom.Client
	OriginalURL         string
	BlossomServer       string
	BatchSigner         nostr.BatchSigner
	Signer              nostr.Signer
	Pubkey              string
	RelayHint           string
	PreDownloaded       *PreDownloadedImages
	Variant             string
	Commit              string
	Channel             string
	Opts                *cli.Options
	AppCreatedAtRelease bool
	MinReleaseTimestamp time.Time // Bump Release.CreatedAt above this (--overwrite-release)
}

UploadParams contains parameters for upload functions.

Jump to

Keyboard shortcuts

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