Update app dev version format

This commit is contained in:
Alex X
2025-12-22 17:22:22 +03:00
parent 79698365bb
commit 212def9ceb
2 changed files with 11 additions and 18 deletions
-8
View File
@@ -16,8 +16,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Fetch tags
run: git fetch --tags origin
- name: Setup Go
uses: actions/setup-go@v5
@@ -120,8 +118,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Fetch tags
run: git fetch --tags origin
- name: Docker meta
id: meta
@@ -179,8 +175,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Fetch tags
run: git fetch --tags origin
- name: Docker meta
id: meta-hw
@@ -236,8 +230,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Fetch tags
run: git fetch --tags origin
- name: Docker meta
id: meta-rk
+11 -10
View File
@@ -7,7 +7,6 @@ import (
"os/exec"
"runtime"
"runtime/debug"
"strings"
)
var (
@@ -92,14 +91,6 @@ func Init() {
func readRevisionTime() (revision, vcsTime string) {
if info, ok := debug.ReadBuildInfo(); ok {
// Rewrite version from -buildvcs info if it is valid.
// Format for tagged version: v1.9.13
// Format for custom commit: v1.9.14-0.20251215184105-753d6617ab58
// Format for modified code: v1.9.14-0.20251215184105-753d6617ab58+dirty
if s, ok := strings.CutPrefix(info.Main.Version, "v"); ok {
Version = s
}
for _, setting := range info.Settings {
switch setting.Key {
case "vcs.revision":
@@ -112,10 +103,20 @@ func readRevisionTime() (revision, vcsTime string) {
vcsTime = setting.Value
case "vcs.modified":
if setting.Value == "true" {
revision += "+dirty"
revision += ".dirty"
}
}
}
// Check version from -buildvcs info
// Format for tagged version : v1.9.13
// Format for modified code: v1.9.14-0.20251215184105-753d6617ab58+dirty
if info.Main.Version != "v"+Version {
// Format: 1.9.13+dev.753d661[.dirty]
// Compatible with "awesomeversion" and "packaging.version" from python.
// Version will be larger than the previous release, but smaller than the next release.
Version += "+dev." + revision
}
}
return
}