diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index 894487b449..e64fee1958 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -429,6 +429,7 @@ func prepareMigrationTasks() []*migration { newMigration(349, "Add security scanning tables", v1_27.AddSecurityScanningTables), newMigration(350, "Add issue type definitions table", v1_27.AddIssueTypeDefTable), newMigration(351, "Add CDN public flag to attachments", v1_27.AddAttachmentCDNPublic), + newMigration(352, "Add version prefix to repo manifest", v1_27.AddManifestVersionPrefix), } return preparedMigrations } diff --git a/models/migrations/v1_27/v353.go b/models/migrations/v1_27/v353.go new file mode 100644 index 0000000000..35fe2ffd64 --- /dev/null +++ b/models/migrations/v1_27/v353.go @@ -0,0 +1,14 @@ +// Copyright 2026 Moko Consulting +// SPDX-License-Identifier: GPL-3.0-or-later + +package v1_27 + +import "xorm.io/xorm" + +// AddManifestVersionPrefix adds the version_prefix column to the repo_manifest table. +func AddManifestVersionPrefix(x *xorm.Engine) error { + type RepoManifest struct { + VersionPrefix string `xorm:"TEXT 'version_prefix'"` + } + return x.Sync(new(RepoManifest)) +} diff --git a/models/repo/repo_manifest.go b/models/repo/repo_manifest.go index 39b074702b..e2ab8d6a3e 100644 --- a/models/repo/repo_manifest.go +++ b/models/repo/repo_manifest.go @@ -14,9 +14,9 @@ func init() { db.RegisterModel(new(RepoManifest)) } -// RepoManifest stores moko-platform manifest settings for a repository. +// RepoManifest stores mokoplatform manifest settings for a repository. // These fields correspond to the .mokogitea/manifest.xml schema and are -// exposed via API for use by Actions workflows and the moko-platform CLI. +// exposed via API for use by Actions workflows and the mokoplatform CLI. type RepoManifest struct { ID int64 `xorm:"pk autoincr"` RepoID int64 `xorm:"UNIQUE INDEX NOT NULL 'repo_id'"` @@ -31,9 +31,12 @@ type RepoManifest struct { // governance section Platform string `xorm:"VARCHAR(50) 'platform'"` // go, php, node, python, etc. - StandardsVersion string `xorm:"VARCHAR(20) 'standards_version'"` // moko-platform standards version + StandardsVersion string `xorm:"VARCHAR(20) 'standards_version'"` // mokoplatform standards version StandardsSource string `xorm:"TEXT 'standards_source'"` // URL to standards repo + // versioning + VersionPrefix string `xorm:"TEXT 'version_prefix'"` // tag prefix stripped for version display, e.g. "v1.26.1-moko." + // build section Language string `xorm:"VARCHAR(50) 'language'"` // Go, PHP, TypeScript, etc. PackageType string `xorm:"VARCHAR(50) 'package_type'"` // application, library, plugin, module, component, package diff --git a/options/locale/locale_en-US.json b/options/locale/locale_en-US.json index 655508f7ec..96899564ee 100644 --- a/options/locale/locale_en-US.json +++ b/options/locale/locale_en-US.json @@ -2740,6 +2740,7 @@ "repo.settings.manifest_org": "Organization", "repo.settings.manifest_description": "Description", "repo.settings.manifest_version": "Version", + "repo.settings.manifest_version_prefix": "Version Prefix", "repo.settings.manifest_license_spdx": "License (SPDX)", "repo.settings.manifest_license_name": "License Name", "repo.settings.manifest_governance": "Governance", diff --git a/routers/api/v1/repo/manifest.go b/routers/api/v1/repo/manifest.go index ce8c45d6b7..2026d06803 100644 --- a/routers/api/v1/repo/manifest.go +++ b/routers/api/v1/repo/manifest.go @@ -19,6 +19,7 @@ type apiManifest struct { Version string `json:"version"` LicenseSPDX string `json:"license_spdx"` LicenseName string `json:"license_name"` + VersionPrefix string `json:"version_prefix"` Platform string `json:"platform"` StandardsVersion string `json:"standards_version"` StandardsSource string `json:"standards_source"` @@ -60,6 +61,7 @@ func GetRepoManifest(ctx *context.APIContext) { Version: m.Version, LicenseSPDX: m.LicenseSPDX, LicenseName: m.LicenseName, + VersionPrefix: m.VersionPrefix, Platform: m.Platform, StandardsVersion: m.StandardsVersion, StandardsSource: m.StandardsSource, @@ -95,6 +97,7 @@ func UpdateRepoManifest(ctx *context.APIContext) { Version: req.Version, LicenseSPDX: req.LicenseSPDX, LicenseName: req.LicenseName, + VersionPrefix: req.VersionPrefix, Platform: req.Platform, StandardsVersion: req.StandardsVersion, StandardsSource: req.StandardsSource, @@ -115,6 +118,7 @@ func UpdateRepoManifest(ctx *context.APIContext) { Version: m.Version, LicenseSPDX: m.LicenseSPDX, LicenseName: m.LicenseName, + VersionPrefix: m.VersionPrefix, Platform: m.Platform, StandardsVersion: m.StandardsVersion, StandardsSource: m.StandardsSource, diff --git a/routers/web/repo/setting/manifest.go b/routers/web/repo/setting/manifest.go index 2216599c57..26942a1e3f 100644 --- a/routers/web/repo/setting/manifest.go +++ b/routers/web/repo/setting/manifest.go @@ -18,18 +18,19 @@ const tplSettingsManifest templates.TplName = "repo/settings/manifest" // manifestXML mirrors the .mokogitea/manifest.xml schema for XML parsing. type manifestXML struct { - XMLName xml.Name `xml:"moko-platform"` + XMLName xml.Name `xml:"mokoplatform"` Identity manifestIdentity `xml:"identity"` Governance manifestGovernance `xml:"governance"` Build manifestBuild `xml:"build"` } type manifestIdentity struct { - Name string `xml:"name"` - Org string `xml:"org"` - Description string `xml:"description"` - Version string `xml:"version"` - License manifestLicense `xml:"license"` + Name string `xml:"name"` + Org string `xml:"org"` + Description string `xml:"description"` + Version string `xml:"version"` + VersionPrefix string `xml:"version-prefix"` + License manifestLicense `xml:"license"` } type manifestLicense struct { @@ -92,6 +93,7 @@ func ManifestSettingsPost(ctx *context.Context) { Version: ctx.FormString("version"), LicenseSPDX: ctx.FormString("license_spdx"), LicenseName: ctx.FormString("license_name"), + VersionPrefix: ctx.FormString("version_prefix"), Platform: ctx.FormString("platform"), StandardsVersion: ctx.FormString("standards_version"), StandardsSource: ctx.FormString("standards_source"), @@ -142,6 +144,7 @@ func tryMigrateManifestXML(ctx *context.Context) *repo_model.RepoManifest { Version: mxml.Identity.Version, LicenseSPDX: mxml.Identity.License.SPDX, LicenseName: mxml.Identity.License.Name, + VersionPrefix: mxml.Identity.VersionPrefix, Platform: mxml.Governance.Platform, StandardsVersion: mxml.Governance.StandardsVersion, StandardsSource: mxml.Governance.StandardsSource, diff --git a/templates/repo/settings/manifest.tmpl b/templates/repo/settings/manifest.tmpl index cbae357196..68aeb2dbf2 100644 --- a/templates/repo/settings/manifest.tmpl +++ b/templates/repo/settings/manifest.tmpl @@ -19,11 +19,15 @@ -
+
+
+ + +
@@ -41,7 +45,7 @@ @@ -60,18 +64,26 @@
- +
+ {{if eq .Manifest.Platform "joomla"}}
+ {{end}}