Documentation ¶
Overview ¶
Package gitea contains high level helper routines for interacting with the Gitea releases using the API.
Index ¶
- func CreateRelease(clt *gitea.Client, opts CreateReleaseOpts) (*gitea.Release, error)
- func DownloadReleaseAssets(clt *gitea.Client, release *gitea.Release, destDir string, globs []string) error
- func GetReleaseByID(clt *gitea.Client, owner, repo, releaseIDStr string) (*gitea.Release, error)
- func GetReleaseByTag(clt *gitea.Client, owner, repo, tagName string) (*gitea.Release, error)
- func GetReleases(clt *gitea.Client, opts ListReleaseOpts) ([]*gitea.Release, error)
- func NewGiteaClient(serverURL, accessToken string) (*gitea.Client, error)
- func UpdateRelease(clt *gitea.Client, id int64, opts CreateReleaseOpts) (*gitea.Release, error)
- func UploadReleaseAssetFromPath(clt *gitea.Client, path, owner, repo string, releaseID int64) error
- type CreateReleaseOpts
- type ListReleaseOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateRelease ¶
CreateRelease will create a new release with the given parameters.
func DownloadReleaseAssets ¶
func DownloadReleaseAssets(clt *gitea.Client, release *gitea.Release, destDir string, globs []string) error
DownloadReleaseAssets downloads the associated assets from the given release to the provided destination directory. The release assets to download can be filtered using glob syntax.
func GetReleaseByID ¶
GetReleaseByID returns the corresponding release for the given ID string.
func GetReleaseByTag ¶
GetReleaseByTag returns the corresponding release for the given tag name.
func GetReleases ¶
GetReleases returns all the releases that match the provided filter options. This will handle pagination, going through all release pages.
func NewGiteaClient ¶
NewGiteaClient returns an authenticated gitea API client for the given server URL.
func UpdateRelease ¶
UpdateRelease will update an existing release with the given parameters.
Types ¶
type CreateReleaseOpts ¶
type CreateReleaseOpts struct { // Owner is the owner of the repository in the target Gitea instance. Owner string // Repo is the name of the repository in the target Gitea instance. Repo string // Tag represents the tag to create for the release. Tag string // Target is the git ref (SHA, tag, branch) where the release tag should be applied. Target string // Title is the title to apply to the release. Title string // Body is the body to apply to the release. Body string // IsPreRelease indicates whether the new release should be marked as a prerelease. IsPreRelease bool }
CreateReleaseOpts is a struct representing the metadata for creating a new release.
type ListReleaseOpts ¶
type ListReleaseOpts struct { // Owner is the owner of the repository in the target Gitea instance. Owner string // Repo is the name of the repository in the target Gitea instance. Repo string // SemverConstraint is a semantic versioning constraint in the same syntax as Terraform. Refer to // https://www.terraform.io/language/expressions/version-constraints for supported syntax. SemverConstraint version.Constraints // IncludePreRelease indicates if pre releases should be included in the query. IncludePreRelease bool }
ListReleaseOpts is a struct representing the filters to apply when querying for releases.
func NewListReleaseOpts ¶
func NewListReleaseOpts(owner, repo, semverConstraintStr string, includePreRelease bool) (*ListReleaseOpts, error)
NewListReleaseOpts constructs a new ListReleaseOpts filter based on the provided raw values.