feat: Update versioning and commit information in Makefile and version command
- Added CUI commit information to the Makefile for artifact generation. - Enhanced version command output to include Yao and CUI commit details with improved formatting. - Updated constant names in share/const.go for clarity on versioning. - Fixed references to CUI commit in process and app files to align with new naming conventions.
This commit is contained in:
parent
f55fc7b374
commit
4c026755c4
5 changed files with 42 additions and 27 deletions
12
Makefile
12
Makefile
|
|
@ -6,6 +6,8 @@ VETPACKAGES ?= $(shell $(GO) list ./... | grep -v /examples/)
|
|||
GOFILES := $(shell find . -name "*.go")
|
||||
VERSION := $(shell grep 'const VERSION =' share/const.go |awk '{print $$4}' |sed 's/\"//g')
|
||||
COMMIT := $(shell git log | head -n 1 | awk '{print substr($$2, 0, 12)}')
|
||||
CUI_COMMIT_RELEASE := $(shell cd .tmp/cui/v1.0 && git log | head -n 1 | awk '{print substr($$2, 0, 12)}')
|
||||
CUI_COMMIT_ARTIFACTS := $(shell cd ../cui-v1.0 && git log | head -n 1 | awk '{print $$2}')
|
||||
NOW := $(shell date +"%FT%T%z")
|
||||
OS := $(shell uname)
|
||||
|
||||
|
|
@ -175,6 +177,7 @@ artifacts-linux: clean
|
|||
|
||||
# Replace PRVERSION
|
||||
sed -ie "s/const PRVERSION = \"DEV\"/const PRVERSION = \"${COMMIT}-${NOW}\"/g" share/const.go
|
||||
sed -ie "s/const PRCUI = \"DEV\"/const PRCUI = \"${CUI_COMMIT_ARTIFACTS}-${NOW}\"/g" share/const.go
|
||||
|
||||
# Making artifacts
|
||||
mkdir -p dist
|
||||
|
|
@ -209,13 +212,6 @@ artifacts-macos: clean
|
|||
cd ../yao-init && rm -rf LICENSE
|
||||
# cd ../yao-init && rm -rf README.md
|
||||
|
||||
# Yao Builder
|
||||
# Remove Yao Builder - DUI PageBuilder component will provide online design for pure HTML pages or SUI pages in the future.
|
||||
# mkdir -p .tmp/data/builder
|
||||
# curl -o .tmp/yao-builder-latest.tar.gz https://release-sv.yaoapps.com/archives/yao-builder-latest.tar.gz
|
||||
# tar -zxvf .tmp/yao-builder-latest.tar.gz -C .tmp/data/builder
|
||||
# rm -rf .tmp/yao-builder-latest.tar.gz
|
||||
|
||||
# Packing
|
||||
# ** CUI will be renamed to CUI in the feature. and move to the new repository. **
|
||||
# ** new repository: https://github.com/YaoApp/cui.git **
|
||||
|
|
@ -230,6 +226,7 @@ artifacts-macos: clean
|
|||
|
||||
# Replace PRVERSION
|
||||
sed -ie "s/const PRVERSION = \"DEV\"/const PRVERSION = \"${COMMIT}-${NOW}\"/g" share/const.go
|
||||
sed -ie "s/const PRCUI = \"DEV\"/const PRCUI = \"${CUI_COMMIT_ARTIFACTS}-${NOW}\"/g" share/const.go
|
||||
|
||||
# Making artifacts
|
||||
mkdir -p dist
|
||||
|
|
@ -316,6 +313,7 @@ release: clean
|
|||
|
||||
# Replace PRVERSION
|
||||
sed -ie "s/const PRVERSION = \"DEV\"/const PRVERSION = \"${COMMIT}-${NOW}\"/g" share/const.go
|
||||
sed -ie "s/const PRCUI = \"DEV\"/const PRCUI = \"${CUI_COMMIT_RELEASE}-${NOW}\"/g" share/const.go
|
||||
|
||||
# Making artifacts
|
||||
mkdir -p dist
|
||||
|
|
|
|||
|
|
@ -2,18 +2,22 @@ package cmd
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/yaoapp/yao/share"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/fatih/color"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/yaoapp/yao/share"
|
||||
)
|
||||
|
||||
var printAllVersion bool
|
||||
var versionTemplate = `Version: %s
|
||||
Go version: %s
|
||||
Git commit: %s
|
||||
Built: %s
|
||||
OS/Arch: %s/%s
|
||||
var versionTemplate = `Version: %s
|
||||
Go version: %s
|
||||
Yao commit: %s
|
||||
Cui version: %s
|
||||
Cui commit: %s
|
||||
Built: %s
|
||||
OS/Arch: %s/%s
|
||||
`
|
||||
var versionCmd = &cobra.Command{
|
||||
Use: "version",
|
||||
|
|
@ -23,16 +27,29 @@ var versionCmd = &cobra.Command{
|
|||
if printAllVersion {
|
||||
commit := strings.Split(share.PRVERSION, "-")[0]
|
||||
buildTime := strings.TrimPrefix(share.PRVERSION, commit+"-")
|
||||
fmt.Printf(versionTemplate,
|
||||
share.VERSION,
|
||||
runtime.Version(),
|
||||
commit, buildTime,
|
||||
runtime.GOOS,
|
||||
runtime.GOARCH)
|
||||
cuiCommit := strings.Split(share.PRCUI, "-")[0]
|
||||
|
||||
fmt.Printf("%s", color.WhiteString("Yao version: "))
|
||||
fmt.Printf("%s\n", color.GreenString(share.VERSION))
|
||||
|
||||
fmt.Printf("%s", color.WhiteString("Yao commit: "))
|
||||
fmt.Printf("%s\n", color.YellowString(commit))
|
||||
|
||||
fmt.Printf("%s", color.WhiteString("Cui commit: "))
|
||||
fmt.Printf("%s\n", color.YellowString(cuiCommit))
|
||||
|
||||
fmt.Printf("%s", color.WhiteString("Built: "))
|
||||
fmt.Printf("%s\n", color.BlueString(buildTime))
|
||||
|
||||
fmt.Printf("%s", color.WhiteString("OS/Arch: "))
|
||||
fmt.Printf("%s\n", color.MagentaString("%s/%s", runtime.GOOS, runtime.GOARCH))
|
||||
|
||||
fmt.Printf("%s", color.WhiteString("Go version: "))
|
||||
fmt.Printf("%s\n", color.CyanString(runtime.Version()))
|
||||
return
|
||||
}
|
||||
// Do Stuff Here
|
||||
fmt.Println(share.VERSION)
|
||||
fmt.Printf("%s", color.WhiteString("Yao version: "))
|
||||
fmt.Printf("%s\n", color.GreenString(share.VERSION))
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ func processPing(process *process.Process) interface{} {
|
|||
func processInspect(process *process.Process) interface{} {
|
||||
return map[string]interface{}{
|
||||
"VERSION": fmt.Sprintf("%s %s", share.VERSION, share.PRVERSION),
|
||||
"CUI": fmt.Sprintf("%s %s", share.CUI, share.PRECUI),
|
||||
"CUI": fmt.Sprintf("%s %s", share.CUI, share.PRCUI),
|
||||
"BUILDNAME": share.BUILDNAME,
|
||||
"CONFIG": config.Conf,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,14 +3,14 @@ package share
|
|||
// VERSION Yao App Engine Version
|
||||
const VERSION = "0.10.5"
|
||||
|
||||
// PRVERSION Yao App Engine PreRelease Version
|
||||
// PRVERSION Yao App Engine PR Commit
|
||||
const PRVERSION = "DEV"
|
||||
|
||||
// CUI Version
|
||||
const CUI = "0.10.5"
|
||||
|
||||
// PRECUI PreRelease Version
|
||||
const PRECUI = "DEV"
|
||||
// PRCUI CUI PR Commit
|
||||
const PRCUI = "DEV"
|
||||
|
||||
// BUILDIN If true, the application will be built into a single artifact
|
||||
const BUILDIN = false
|
||||
|
|
|
|||
|
|
@ -588,7 +588,7 @@ func processXgen(process *process.Process) interface{} {
|
|||
},
|
||||
"cui": map[string]interface{}{
|
||||
"version": share.CUI,
|
||||
"prversion": share.PRECUI,
|
||||
"prversion": share.PRCUI,
|
||||
},
|
||||
"theme": Setting.Theme,
|
||||
"lang": Setting.Lang,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue