commit
a2933ef03e
@ -6,11 +6,11 @@ EVENT_DATA=$(cat $GITHUB_EVENT_PATH)
|
||||
echo $EVENT_DATA | jq .
|
||||
UPLOAD_URL=$(echo $EVENT_DATA | jq -r .release.upload_url)
|
||||
UPLOAD_URL=${UPLOAD_URL/\{?name,label\}/}
|
||||
RELEASE_NAME=$(echo $EVENT_DATA | jq -r .release.tag_name)
|
||||
RELEASE_VERSION=$(echo $EVENT_DATA | jq -r .release.tag_name)
|
||||
PROJECT_NAME=$(basename $GITHUB_REPOSITORY)
|
||||
NAME="${NAME:-${PROJECT_NAME}-${RELEASE_NAME}}-${GOOS}-${GOARCH}"
|
||||
NAME="${NAME:-${PROJECT_NAME}-${RELEASE_VERSION}}-${GOOS}-${GOARCH}"
|
||||
|
||||
go build .
|
||||
CGO_ENABLED=0 go build -ldflags "-X 'github.com/qiniu/goc/cmd.version=${RELEASE_VERSION}'" .
|
||||
|
||||
ARCHIVE=tmp.tar.gz
|
||||
FILE_LIST=goc
|
||||
|
42
cmd/version.go
Normal file
42
cmd/version.go
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
Copyright 2020 Qiniu Cloud (qiniu.com)
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// the version value will be injected when publishing
|
||||
var version = "Unstable"
|
||||
|
||||
var versionCmd = &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Print the goc version information",
|
||||
Example: `
|
||||
# Print the client and server versions for the current context
|
||||
goc version
|
||||
`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Println(version)
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(versionCmd)
|
||||
}
|
1
go.mod
1
go.mod
@ -7,7 +7,6 @@ require (
|
||||
github.com/google/go-github v17.0.0+incompatible
|
||||
github.com/hashicorp/go-retryablehttp v0.6.6
|
||||
github.com/julienschmidt/httprouter v1.2.0
|
||||
github.com/magiconair/properties v1.8.1
|
||||
github.com/mattn/go-runewidth v0.0.9 // indirect
|
||||
github.com/olekukonko/tablewriter v0.0.4
|
||||
github.com/onsi/ginkgo v1.11.0
|
||||
|
Loading…
Reference in New Issue
Block a user