Update app dev version format
This commit is contained in:
@@ -16,8 +16,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Fetch tags
|
|
||||||
run: git fetch --tags origin
|
|
||||||
|
|
||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
@@ -120,8 +118,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Fetch tags
|
|
||||||
run: git fetch --tags origin
|
|
||||||
|
|
||||||
- name: Docker meta
|
- name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
@@ -179,8 +175,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Fetch tags
|
|
||||||
run: git fetch --tags origin
|
|
||||||
|
|
||||||
- name: Docker meta
|
- name: Docker meta
|
||||||
id: meta-hw
|
id: meta-hw
|
||||||
@@ -236,8 +230,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Fetch tags
|
|
||||||
run: git fetch --tags origin
|
|
||||||
|
|
||||||
- name: Docker meta
|
- name: Docker meta
|
||||||
id: meta-rk
|
id: meta-rk
|
||||||
|
|||||||
+11
-10
@@ -7,7 +7,6 @@ import (
|
|||||||
"os/exec"
|
"os/exec"
|
||||||
"runtime"
|
"runtime"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -92,14 +91,6 @@ func Init() {
|
|||||||
|
|
||||||
func readRevisionTime() (revision, vcsTime string) {
|
func readRevisionTime() (revision, vcsTime string) {
|
||||||
if info, ok := debug.ReadBuildInfo(); ok {
|
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 {
|
for _, setting := range info.Settings {
|
||||||
switch setting.Key {
|
switch setting.Key {
|
||||||
case "vcs.revision":
|
case "vcs.revision":
|
||||||
@@ -112,10 +103,20 @@ func readRevisionTime() (revision, vcsTime string) {
|
|||||||
vcsTime = setting.Value
|
vcsTime = setting.Value
|
||||||
case "vcs.modified":
|
case "vcs.modified":
|
||||||
if setting.Value == "true" {
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user