sourceconditiontarget

✔

✔

✔

Description

The gitea/release resource works with the releases published on a Gitea repository.

source

Returns the release matching versionfilter.

condition

Tests that a release exists for the repository.

target

Creates the release when one does not already exist for the tag. This is one of the few resources that publish something rather than edit a file.

Note
An scm attached to a condition is ignored, with a warning. The lookup always goes to the Gitea API.

Parameters

NameTypeDescriptionRequired
ageobject

“age” defines the minimum and maximum age of a release to be considered valid.

compatible:

  • source

remark:

  • “minimum” and “maximum” accept a duration string such as “24h”, “7d”, “3w”, “1mo” or “1y”.
  • accepted units are “h” for hours, “d” for days, “w” for weeks, “mo” for months and “y” for years. A unit is required.
  • when every release is filtered out by its age, the source is skipped instead of failing.

example:

  • age: minimum: 7d
    maximumstring

“maximum” defines the maximum age a release may have to be considered.

remark:

  • accepted units are “d” for days, “w” for weeks, “mo” for months and “y” for years, plus the Go duration units such as “h”, “m” and “s”.
  • a unit is required.
  • a month counts as 1/12 of a year and a year as 365 days.

example:

  • maximum: 6mo
  • maximum: 1y
    minimumstring

“minimum” defines the minimum age a release must have to be considered.

remark:

  • accepted units are “d” for days, “w” for weeks, “mo” for months and “y” for years, plus the Go duration units such as “h”, “m” and “s”.
  • a unit is required.
  • a month counts as 1/12 of a year and a year as 365 days.

example:

  • minimum: 24h
  • minimum: 7d
  • minimum: 3w
commitishstring

“commitish” defines the commit-ish used to create the release tag, such as a branch name or a commit sha.

compatible:

  • target

default: main

example:

  • commitish: main
descriptionstring

“description” defines the description of the release.

compatible:

  • target

remark:

  • Updatecli appends a credit line to the description.
draftboolean

“draft” defines whether the release is a draft.

compatible:

  • target

default: false

ownerstring

“owner” defines the owner of the Gitea repository.

compatible:

  • source
  • condition
  • target

example:

  • owner: updatecli
prereleaseboolean

“prerelease” defines whether the release is a pre-release.

compatible:

  • target

default: false

repositorystring

“repository” defines the name of the Gitea repository for a specific owner.

compatible:

  • source
  • condition
  • target

example:

  • repository: updatecli
tagstring

“tag” defines the tag of the Gitea release.

compatible:

  • condition
  • target

default: the output of the associated source.

example:

  • tag: v1.0.0
titlestring

“title” defines the title of the Gitea release.

compatible:

  • target

default: the value of “tag”.

tokenstring

“token” defines the credential used to authenticate with the Gitea API.

remark:

  • a token is sensitive information. Do not set it directly in the manifest. Use an environment variable or a SOPS file instead.
  • {{ requiredEnv "GITEA_TOKEN" }} retrieves the token from the environment variable “GITEA_TOKEN”.
  • {{ .gitea.token }} retrieves the token from a SOPS file. See https://github.com/getsops/sops for more information about SOPS files.
  • in a “gitea/pullrequest” action, the value is inherited from the scm when unset.
urlstring

“url” defines the Gitea url to interact with.

remark:

  • “https://” is added when the url has no “https://” or “http://” prefix.
  • in a “gitea/pullrequest” action, the value is inherited from the scm when unset.

example:

  • url: gitea.com
  • url: https://gitea.example.com
usernamestring

“username” defines the username used to authenticate with the Gitea API.

remark:

  • in a “gitea/pullrequest” action, the value is inherited from the scm when unset.
versionfilterobject

“versionfilter” defines the version pattern and kind used to select a release tag.

compatible:

  • source

default: kind: latest

remark:

  • accepted kinds include “latest”, “semver” and “regex”.

example:

  • versionfilter: kind: semver pattern: “~1.2”
    kindstring

“kind” defines the versioning scheme used to select a version.

default: latest

remark:

  • accepted values are “latest”, “semver”, “regex”, “regex/semver”, “time”, “regex/time”, “lex” and “pep440”.
  • “latest” returns the last version of the list.
  • “lex” sorts the versions lexicographically and returns the last one.
  • “pep440” follows https://peps.python.org/pep-0440/

example:

  • kind: semver
    patternstring

“pattern” defines the version pattern, according to “kind”.

default:

  • latest: “latest”
  • semver and pep440: “*”
  • regex: “.*”
  • time and regex/time: “2006-01-02”

remark:

  • for “latest”, “latest” returns the last version, any other value must match a version exactly.
  • for “semver” and “regex/semver”, it is a semantic versioning constraint.
  • for “pep440”, it is a pep440 version specifier.
  • for “regex”, it is a regular expression.
  • for “time” and “regex/time”, it is a Go date layout.
  • ignored by “lex”.

example:

  • pattern: ~1.2
  • pattern: “>=1.0.0 <2.0.0”
  • pattern: ^v\d+.\d+.\d+$
    regexstring

“regex” defines the regular expression extracting the version from each entry.

remark:

  • only used by the kinds “regex/semver” and “regex/time”.
  • the value of the first capture group is used as the version.

example:

  • regex: ^v(\d+.\d+.\d+)$
    replaceallobject

“replaceall” applies a regular expression replacement to each version before filtering.

remark:

  • only used by the kinds “regex”, “regex/semver” and “regex/time”.
  • the replacement runs before “pattern” or “regex” is evaluated.

example:

replaceall:
  pattern: "_"
  replacement: "."

turns “curl-8_15_0” into “curl-8.15.0”.

    strictboolean

“strict” enforces strict semantic versioning rules when parsing versions.

default: false

remark:

  • only used by the kinds “semver” and “regex/semver”.

owner and repository are mandatory. url points at your Gitea instance, e.g. try.gitea.io. There is no default.

Creating a release

These fields apply to a target, and two of them have defaults that are easy to trip over:

FieldBehaviour

tag

The tag the release points at. Defaults to the source output.

title

The release title. Defaults to the tag, so an untitled release is named after its version.

commitish

The branch or commit the tag is created from. Defaults to main, with the warning No commitish provided, fallback to branch "main" - wrong on any repository whose default branch is master or develop, so set it explicitly.

description

The release body.

draft

Publish as a draft.

prerelease

Flag the release as a pre-release.

A release that already exists is left untouched (the target neither updates its title nor its description).

Authentication

token authenticates against the Gitea API. It is sensitive, so read it from the environment or a SOPS file rather than writing it into the manifest:

spec:
  url: try.gitea.io
  token: '{{ requiredEnv "GITEA_TOKEN" }}'
  owner: updatecli
  repository: updatecli

A source or condition on a public repository needs no credential. Creating a release needs write access.

Example

# updatecli.yaml
name: Show Gitea release usage

sources:
  default:
    name: Retrieve latest release matching versionfilter rule
    kind: gitea/release
    spec:
      url: "try.gitea.io"
      owner: olblak
      repository: updatecli-test
      versionfilter:
        kind: semver
        pattern: "~0"

conditions:
  default:
    name: Test that release "0.0.2" exist
    kind: gitea/release
    spec:
      url: "try.gitea.io"
      owner: olblak
      repository: updatecli-test
      tag: "0.0.2"
  sourcedefault:
    name: Test that release retrieved from source 'default' exist
    kind: gitea/release
    sourceid: default
    spec:
      url: "try.gitea.io"
      owner: olblak
      repository: updatecli-test

targets:
  default:
    name: "Ensure release 0.0.1 from branch main exist"
    kind: gitea/release
    spec:
      url: "try.gitea.io"
      owner: olblak
      repository: updatecli-test
      commitish: main
      token: xxx
      tag: "0.0.1"
  sourcedefault:
    name: "Ensure release where tag is retrieved from source 'default' from branch main exist"
    kind: gitea/release
    sourceid: default
    spec:
      url: "try.gitea.io"
      owner: olblak
      repository: updatecli-test
      token: xxx
      commitish: main