Documentation ¶
Index ¶
- Constants
- Variables
- func Checksum(r io.Reader, method string) (string, error)
- func CommonFlag() []cli.Flag
- func CreateGoModZipFromDir(root string, version string) (string, *modfile.File, error)
- func FetchGoModFile(root string) (*modfile.File, error)
- func FindFileByGlobs(globs []string, root string) ([]string, error)
- func Flag() []cli.Flag
- func HideFlag() []cli.Flag
- func IsBuildDebugOpen(c *cli.Context) bool
- func WalkAllByGlob(path string, glob string, ignoreFolder bool) ([]string, error)
- func WriteChecksumsByFiles(files, methods []string, root string) ([]string, error)
- type Config
- type GiteaPackageInfo
- type PackageGoInfo
- type Plugin
- type PluginReleaseClient
Constants ¶
View Source
const ( CheckSumMd5 = "md5" CheckSumSha1 = "sha1" CheckSumSha256 = "sha256" CheckSumSha512 = "sha512" CheckSumAdler32 = "adler32" CheckSumCrc32 = "crc32" CheckSumBlake2b = "blake2b" CheckSumBlake2s = "blake2s" )
View Source
const ( 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 ( CheckSumSupport = []string{ CheckSumMd5, CheckSumSha1, CheckSumSha256, CheckSumSha512, CheckSumAdler32, CheckSumCrc32, CheckSumBlake2b, CheckSumBlake2s, } )
View Source
var ErrGlobsEmpty = fmt.Errorf("globs is empty")
Functions ¶
func CreateGoModZipFromDir ¶ added in v1.1.0
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 IsBuildDebugOpen ¶
func IsBuildDebugOpen(c *cli.Context) bool
func WalkAllByGlob ¶ added in v1.1.0
WalkAllByGlob can walk all path then return as list, by glob with filepath.Glob
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 PackageGoInfo ¶ added in v1.1.0
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 ¶
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)
Click to show internal directories.
Click to hide internal directories.