Files
ocis/ocis-pkg/version/version.go
Lukas Hirt 5cd3a2675a chore: sync version and changelog with released 8.1.0/8.2.0 branches (#12821)
Master's LatestTag was still "8.0.0+dev" and its changelog/ folder
stopped at 8.0.4, even though 8.0.5-8.0.7, 8.1.0, and 8.2.0 have since
been released on their stable branches. The "bump master version"
step that normally follows a stable branch cut was skipped for both
the 8.1 and 8.2 cuts.

- Bump LatestTag to 8.2.0+dev, matching the latest actual release
  (v8.2.0), consistent with how master has always been bumped after
  a release (last released version + "+dev" placeholder, not the
  next unreleased minor).
- Backport the missing changelog/8.0.5, 8.0.6, 8.0.7, 8.1.0, and
  8.2.0 folders from their respective stable branches.
- Remove the now-duplicate fragments from changelog/unreleased/ that
  those folders already cover (106 files) - verified by content/PR
  match against every release folder, not just filename.

Signed-off-by: Lukas Hirt <info@hirt.cz>
2026-08-20 16:01:24 +02:00

79 lines
1.8 KiB
Go

package version
import (
"time"
"github.com/Masterminds/semver"
)
var (
// String gets defined by the build system
String string
// Tag gets defined by the build system
Tag string
// LatestTag is the latest released version plus the dev meta version.
// Will be overwritten by the release pipeline
// Needs a manual change for every tagged release
LatestTag = "8.2.0+dev"
// Date indicates the build date.
// This has been removed, it looks like you can only replace static strings with recent go versions
//Date = time.Now().Format("20060102")
Date = "dev"
// Legacy defines the old long 4 number ownCloud version needed for some clients
Legacy = "10.11.0.0"
// LegacyString defines the old ownCloud version needed for some clients
LegacyString = "10.11.0"
)
// Compiled returns the compile time of this service.
func Compiled() time.Time {
if Date == "dev" {
return time.Now()
}
t, _ := time.Parse("20060102", Date)
return t
}
// GetString returns a version string with pre-releases and metadata
func GetString() string {
return Parsed().String()
}
// Parsed returns a semver Version
func Parsed() (version *semver.Version) {
versionToParse := LatestTag
if Tag != "" {
versionToParse = Tag
}
version, err := semver.NewVersion(versionToParse)
// We have no semver version but a commitid
if err != nil {
// this should never happen
if err != nil {
return &semver.Version{}
}
}
if String != "" {
nVersion, err := version.SetMetadata(String)
if err != nil {
return &semver.Version{}
}
version = &nVersion
}
return version
}
// ParsedLegacy returns the legacy version
func ParsedLegacy() *semver.Version {
parsedVersion, err := semver.NewVersion(LegacyString)
if err != nil {
return &semver.Version{}
}
return parsedVersion
}