gitea_cc_release_plugin

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CheckSumMd5     = "md5"
	CheckSumSha1    = "sha1"
	CheckSumSha256  = "sha256"
	CheckSumSha512  = "sha512"
	CheckSumAdler32 = "adler32"
	CheckSumCrc32   = "crc32"
	CheckSumBlake2b = "blake2b"
	CheckSumBlake2s = "blake2s"
)
View Source
const (
	EnvPluginResultShareHost = "PLUGIN_RESULT_SHARE_HOST"

	NamePluginDebug   = "config.debug"
	EnvPluginTimeOut  = "PLUGIN_TIMEOUT_SECOND"
	NamePluginTimeOut = "config.timeout_second"

	EnvDryRun  = "PLUGIN_DRY_RUN"
	NameDryRun = "config.dry_run"

	EnvDraft  = "PLUGIN_DRAFT"
	NameDraft = "config.draft"

	EnvPrerelease  = "PLUGIN_PRERELEASE"
	NamePrerelease = "config.prerelease"

	EnvRootFolderPath  = "PLUGIN_RELEASE_GITEA_ROOT_FOLDER_PATH"
	NameRootFolderPath = "config.release_gitea_root_folder_path"

	EnvApiBaseUrl  = "PLUGIN_RELEASE_GITEA_BASE_URL"
	NameApiBaseUrl = "config.release_gitea_base_url"

	EnvGiteaInsecure  = "PLUGIN_RELEASE_GITEA_INSECURE"
	NameGiteaInsecure = "config.release_gitea_insecure"

	EnvGiteaApiKey  = "PLUGIN_RELEASE_GITEA_API_KEY"
	NameGiteaApiKey = "config.release_gitea_api_key"

	EnvReleaseFiles  = "PLUGIN_RELEASE_GITEA_FILES"
	NameReleaseFiles = "config.release_gitea_files"

	EnvReleaseFileRootPath  = "PLUGIN_RELEASE_GITEA_FILE_ROOT_PATH"
	NameReleaseFileRootPath = "config.release_gitea_file_root_path"

	EnvFilesChecksum  = "PLUGIN_RELEASE_GITEA_FILES_CHECKSUM"
	NameFilesChecksum = "config.release_gitea_files_checksum"

	EnvFileExistsDo  = "PLUGIN_RELEASE_GITEA_FILE_EXISTS_DO"
	NameFileExistsDo = "config.release_gitea_file_exists_do"

	FileExistsDoOverwrite = "overwrite"
	FileExistsDoFail      = "fail"
	FileExistsDoSkip      = "skip"

	EnvGiteaPublishPackageGo  = "PLUGIN_GITEA_PUBLISH_PACKAGE_GO"
	NameGiteaPublishPackageGo = "config.gitea_publish_package_go"

	EnvGiteaPublishPackagePathGo  = "PLUGIN_GITEA_PUBLISH_PACKAGE_PATH_GO"
	NameGiteaPublishPackagePathGo = "config.gitea_publish_package_path_go"

	EnvGiteaPublishGoRemovePaths  = "PLUGIN_GITEA_PUBLISH_GO_REMOVE_PATHS"
	NameGiteaPublishGoRemovePaths = "config.gitea_publish_go_remove_paths"

	EnvTitle  = "PLUGIN_RELEASE_GITEA_TITLE"
	NameTitle = "config.release_gitea_title"

	EnvNote  = "PLUGIN_RELEASE_GITEA_NOTE"
	NameNote = "config.release_gitea_note"

	EnvNoteByConventionChange  = "PLUGIN_RELEASE_GITEA_NOTE_BY_CONVENTION_CHANGE"
	NameNoteByConventionChange = "config.release_gitea_note_by_convention_change"

	EnvReadChangeLogFile  = "PLUGIN_RELEASE_READ_CHANGE_LOG_FILE"
	NameReadChangeLogFile = "config.release_read_change_log_file"

	EnvGitRemote  = "PLUGIN_RELEASE_GIT_REMOTE"
	NameGitRemote = "config.release_git_remote"
)
View Source
const (
	VersionRcFileName = ".versionrc"
)

Variables

View Source
var (
	ErrMissingTag              = fmt.Errorf("NewReleaseClientByDrone missing tag, please check drone now in tag build")
	ErrPackageNotExist         = fmt.Errorf("PackageFetch not exist, code 404")
	ErrPathCanNotLoadGoModFile = fmt.Errorf("path can not load go.mod")
	ErrPackageGoExists         = fmt.Errorf("package go exists")
)
View Source
var ErrGlobsEmpty = fmt.Errorf("globs is empty")

Functions

func Checksum

func Checksum(r io.Reader, method string) (string, error)

func CommonFlag

func CommonFlag() []cli.Flag

CommonFlag Other modules also have flags

func CreateGoModZipFromDir added in v1.1.0

func CreateGoModZipFromDir(root string, version string) (string, *modfile.File, error)

CreateGoModZipFromDir @doc https://go.dev/ref/mod#zip-files

root go mod root path
version go mod version

return ( out zip path, modfile.File, error )

func FetchGoModFile added in v1.1.0

func FetchGoModFile(root string) (*modfile.File, error)

func FindFileByGlobs

func FindFileByGlobs(globs []string, root string) ([]string, error)

func Flag

func Flag() []cli.Flag

Flag set flag at here

func HideFlag

func HideFlag() []cli.Flag

HideFlag set plugin hide flag at here

func IsBuildDebugOpen

func IsBuildDebugOpen(c *cli.Context) bool

func WalkAllByGlob added in v1.1.0

func WalkAllByGlob(path string, glob string, ignoreFolder bool) ([]string, error)

WalkAllByGlob can walk all path then return as list, by glob with filepath.Glob

func WriteChecksumsByFiles

func WriteChecksumsByFiles(files, methods []string, root string) ([]string, error)

Types

type Config

type Config struct {
	Debug           bool
	TimeoutSecond   uint
	DryRun          bool
	GiteaDraft      bool
	GiteaPrerelease bool

	RootFolderPath string

	GiteaBaseUrl  string
	GiteaInsecure bool
	GiteaApiKey   string

	GiteaReleaseFileGlobs        []string
	GiteaReleaseFileGlobRootPath string
	FilesChecksum                []string
	GiteaFileExistsDo            string

	PublishPackageGo     bool
	PublishPackagePathGo string
	PublishGoRemovePaths []string

	GiteaTitle string
	GiteaNote  string

	NoteByConventionChange bool
	ReadChangeLogFile      string

	GitRemote string
}

Config plugin private config

type GiteaPackageInfo added in v1.1.0

type GiteaPackageInfo struct {
	Id      uint64 `json:"id"`
	Type    string `json:"type"`
	Name    string `json:"name"`
	Version string `json:"version"`
}

type PackageGoInfo added in v1.1.0

type PackageGoInfo struct {
	ModVersion module.Version
}

type Plugin

type Plugin struct {
	Name    string
	Version string
	Drone   drone_info.Drone
	Config  Config
}

Plugin plugin all config

func BindCliFlag

func BindCliFlag(c *cli.Context, cliVersion, cliName string, drone drone_info.Drone) (*Plugin, error)

BindCliFlag check args here

func (*Plugin) CleanResultEnv

func (p *Plugin) CleanResultEnv() error

func (*Plugin) Exec

func (p *Plugin) Exec() error

type PluginReleaseClient added in v1.1.0

type PluginReleaseClient interface {
	GetUploadDesc() string

	SetOTP(otp string)

	SetSudo(sudo string)

	SetBasicAuth(username, password string)

	Title() string

	SetTitle(title string)

	Tag() string

	SetNote(noteContent string)

	BuildRelease() (*gitea.Release, error)

	UploadFiles(releaseID int64) error

	PackageFetch(pkgType, name, version string) (*GiteaPackageInfo, error)

	PackageGoFetch(rootPath string) (error, *PackageGoInfo)

	PackageGoUpload(rootPath string, removePath []string) (error, *PackageGoInfo)
}

func NewReleaseClientByDrone added in v1.1.0

func NewReleaseClientByDrone(drone drone_info.Drone, config Config) (PluginReleaseClient, error)

Jump to

Keyboard shortcuts

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