Merge pull request #959 from trheyi/main
feat: Update versioning and commit information in Makefile and versio…
This commit is contained in:
commit
18db28247c
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")
|
GOFILES := $(shell find . -name "*.go")
|
||||||
VERSION := $(shell grep 'const VERSION =' share/const.go |awk '{print $$4}' |sed 's/\"//g')
|
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)}')
|
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")
|
NOW := $(shell date +"%FT%T%z")
|
||||||
OS := $(shell uname)
|
OS := $(shell uname)
|
||||||
|
|
||||||
|
|
@ -175,6 +177,7 @@ artifacts-linux: clean
|
||||||
|
|
||||||
# Replace PRVERSION
|
# Replace PRVERSION
|
||||||
sed -ie "s/const PRVERSION = \"DEV\"/const PRVERSION = \"${COMMIT}-${NOW}\"/g" share/const.go
|
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
|
# Making artifacts
|
||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
|
|
@ -209,13 +212,6 @@ artifacts-macos: clean
|
||||||
cd ../yao-init && rm -rf LICENSE
|
cd ../yao-init && rm -rf LICENSE
|
||||||
# cd ../yao-init && rm -rf README.md
|
# 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
|
# Packing
|
||||||
# ** CUI will be renamed to CUI in the feature. and move to the new repository. **
|
# ** CUI will be renamed to CUI in the feature. and move to the new repository. **
|
||||||
# ** new repository: https://github.com/YaoApp/cui.git **
|
# ** new repository: https://github.com/YaoApp/cui.git **
|
||||||
|
|
@ -230,6 +226,7 @@ artifacts-macos: clean
|
||||||
|
|
||||||
# Replace PRVERSION
|
# Replace PRVERSION
|
||||||
sed -ie "s/const PRVERSION = \"DEV\"/const PRVERSION = \"${COMMIT}-${NOW}\"/g" share/const.go
|
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
|
# Making artifacts
|
||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
|
|
@ -316,6 +313,7 @@ release: clean
|
||||||
|
|
||||||
# Replace PRVERSION
|
# Replace PRVERSION
|
||||||
sed -ie "s/const PRVERSION = \"DEV\"/const PRVERSION = \"${COMMIT}-${NOW}\"/g" share/const.go
|
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
|
# Making artifacts
|
||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
|
|
|
||||||
|
|
@ -2,18 +2,22 @@ package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/spf13/cobra"
|
|
||||||
"github.com/yaoapp/yao/share"
|
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/fatih/color"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
"github.com/yaoapp/yao/share"
|
||||||
)
|
)
|
||||||
|
|
||||||
var printAllVersion bool
|
var printAllVersion bool
|
||||||
var versionTemplate = `Version: %s
|
var versionTemplate = `Version: %s
|
||||||
Go version: %s
|
Go version: %s
|
||||||
Git commit: %s
|
Yao commit: %s
|
||||||
Built: %s
|
Cui version: %s
|
||||||
OS/Arch: %s/%s
|
Cui commit: %s
|
||||||
|
Built: %s
|
||||||
|
OS/Arch: %s/%s
|
||||||
`
|
`
|
||||||
var versionCmd = &cobra.Command{
|
var versionCmd = &cobra.Command{
|
||||||
Use: "version",
|
Use: "version",
|
||||||
|
|
@ -23,16 +27,29 @@ var versionCmd = &cobra.Command{
|
||||||
if printAllVersion {
|
if printAllVersion {
|
||||||
commit := strings.Split(share.PRVERSION, "-")[0]
|
commit := strings.Split(share.PRVERSION, "-")[0]
|
||||||
buildTime := strings.TrimPrefix(share.PRVERSION, commit+"-")
|
buildTime := strings.TrimPrefix(share.PRVERSION, commit+"-")
|
||||||
fmt.Printf(versionTemplate,
|
cuiCommit := strings.Split(share.PRCUI, "-")[0]
|
||||||
share.VERSION,
|
|
||||||
runtime.Version(),
|
fmt.Printf("%s", color.WhiteString("Yao version: "))
|
||||||
commit, buildTime,
|
fmt.Printf("%s\n", color.GreenString(share.VERSION))
|
||||||
runtime.GOOS,
|
|
||||||
runtime.GOARCH)
|
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
|
return
|
||||||
}
|
}
|
||||||
// Do Stuff Here
|
fmt.Printf("%s", color.WhiteString("Yao version: "))
|
||||||
fmt.Println(share.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{} {
|
func processInspect(process *process.Process) interface{} {
|
||||||
return map[string]interface{}{
|
return map[string]interface{}{
|
||||||
"VERSION": fmt.Sprintf("%s %s", share.VERSION, share.PRVERSION),
|
"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,
|
"BUILDNAME": share.BUILDNAME,
|
||||||
"CONFIG": config.Conf,
|
"CONFIG": config.Conf,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,14 @@ package share
|
||||||
// VERSION Yao App Engine Version
|
// VERSION Yao App Engine Version
|
||||||
const VERSION = "0.10.5"
|
const VERSION = "0.10.5"
|
||||||
|
|
||||||
// PRVERSION Yao App Engine PreRelease Version
|
// PRVERSION Yao App Engine PR Commit
|
||||||
const PRVERSION = "DEV"
|
const PRVERSION = "DEV"
|
||||||
|
|
||||||
// CUI Version
|
// CUI Version
|
||||||
const CUI = "0.10.5"
|
const CUI = "0.10.5"
|
||||||
|
|
||||||
// PRECUI PreRelease Version
|
// PRCUI CUI PR Commit
|
||||||
const PRECUI = "DEV"
|
const PRCUI = "DEV"
|
||||||
|
|
||||||
// BUILDIN If true, the application will be built into a single artifact
|
// BUILDIN If true, the application will be built into a single artifact
|
||||||
const BUILDIN = false
|
const BUILDIN = false
|
||||||
|
|
|
||||||
|
|
@ -588,7 +588,7 @@ func processXgen(process *process.Process) interface{} {
|
||||||
},
|
},
|
||||||
"cui": map[string]interface{}{
|
"cui": map[string]interface{}{
|
||||||
"version": share.CUI,
|
"version": share.CUI,
|
||||||
"prversion": share.PRECUI,
|
"prversion": share.PRCUI,
|
||||||
},
|
},
|
||||||
"theme": Setting.Theme,
|
"theme": Setting.Theme,
|
||||||
"lang": Setting.Lang,
|
"lang": Setting.Lang,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue