Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Jenkins 中文社区
jenkins-cli
提交
c20085a8
J
jenkins-cli
项目概览
Jenkins 中文社区
/
jenkins-cli
通知
49
Star
8
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins-cli
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
c20085a8
编写于
7月 22, 2019
作者:
LinuxSuRen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add support to print version of app
上级
6afad2e1
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
15 addition
and
23 deletion
+15
-23
Makefile
Makefile
+3
-1
app/cmd/root.go
app/cmd/root.go
+2
-3
app/version.go
app/version.go
+9
-9
app/version_current.go
app/version_current.go
+0
-9
release.sh
release.sh
+1
-1
未找到文件。
Makefile
浏览文件 @
c20085a8
...
...
@@ -2,7 +2,9 @@ NAME := jcli
CGO_ENABLED
=
0
GO
:=
go
BUILD_TARGET
=
build
BUILDFLAGS
=
COMMIT
:=
$(
shell
git rev-parse
--short
HEAD
)
VERSION
:=
dev-
$(
shell
git describe
--tags
$(
shell
git rev-list
--tags
--max-count
=
1
))
BUILDFLAGS
=
-ldflags
"-X github.com/linuxsuren/jenkins-cli/app.version=
$(VERSION)
-X github.com/linuxsuren/jenkins-cli/app.commit=
$(COMMIT)
"
COVERED_MAIN_SRC_FILE
=
./main
darwin
:
##
Build for OSX
...
...
app/cmd/root.go
浏览文件 @
c20085a8
...
...
@@ -30,9 +30,8 @@ var rootCmd = &cobra.Command{
}
if
rootOptions
.
Version
{
fmt
.
Printf
(
"Version: v%.2f.%d%s"
,
app
.
CurrentVersion
.
Number
,
app
.
CurrentVersion
.
PatchLevel
,
app
.
CurrentVersion
.
Suffix
)
fmt
.
Printf
(
"Version: %s
\n
"
,
app
.
GetVersion
())
fmt
.
Printf
(
"Commit: %s
\n
"
,
app
.
GetCommit
())
}
},
}
...
...
app/version.go
浏览文件 @
c20085a8
package
app
// Version represents the Jenkins CLI build version.
type
Version
struct
{
// Major and minor version.
Number
float32
var
(
version
string
commit
string
)
// Increment this for bug releases
PatchLevel
int
func
GetVersion
()
string
{
return
version
}
// JCLI Suffix is the suffix used in the Jenkins CLI version string.
// It will be blank for release versions.
Suffix
string
func
GetCommit
()
string
{
return
commit
}
app/version_current.go
已删除
100644 → 0
浏览文件 @
6afad2e1
package
app
// CurrentVersion represents the current build version.
// This should be the only one.
var
CurrentVersion
=
Version
{
Number
:
0.0
,
PatchLevel
:
9
,
Suffix
:
"-DEV"
,
}
release.sh
浏览文件 @
c20085a8
...
...
@@ -15,7 +15,7 @@ echo "Updating $VERSION to $NEW_TAG"
# NEEDS_TAG=`git describe --contains $GIT_COMMIT`
if
[[
-z
"
${
NEEDS_TAG
}
"
]]
;
then
make release
make release
VERSION
=
${
NEW_TAG
}
hub release create
-c
-a
release/jcli-darwin-amd64.tar.gz
\
-a
release/jcli-linux-amd64.tar.gz
\
-a
release/jcli-windows-386.tar.gz
${
NEW_TAG
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录