Skip to content

Commit 98496b1

Browse files
stefanprodanerrordeveloper
authored andcommitted
Add gorelease to CI, version command
1 parent 0c84bb5 commit 98496b1

File tree

6 files changed

+65
-9
lines changed

6 files changed

+65
-9
lines changed

.circleci/config.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,30 @@ jobs:
99
- setup_remote_docker: {docker_layer_caching: true}
1010
# just a simple build for now, but will use skaffold if it gets more complex
1111
- run: docker build .
12+
deploy:
13+
docker:
14+
- image: circleci/golang:1.10
15+
working_directory: /go/src/github.com/weaveworks/eksctl
16+
steps:
17+
- checkout
18+
- setup_remote_docker: {docker_layer_caching: true}
19+
- run: make install-bindata
20+
- run: make update-bindata
21+
- run:
22+
name: Build and publish
23+
command: |
24+
if [[ -z "${CIRCLE_PULL_REQUEST}" ]] && [[ "${CIRCLE_TAG}" ]] && [[ "${CIRCLE_PROJECT_USERNAME}" = "weaveworks" ]] ; then
25+
curl -sL https://git.io/goreleaser | bash
26+
else
27+
echo "No deploy on PR"
28+
fi
29+
30+
workflows:
31+
version: 2
32+
build-and-deploy:
33+
jobs:
34+
- build
35+
- deploy:
36+
filters:
37+
tags:
38+
only: /^[0-9].*/

.gitignore

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,5 @@
77
# Test binary, build with `go test -c`
88
*.test
99

10-
# Output of the go coverage tool, specifically when used with LiteIDE
11-
*.out
12-
13-
# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
14-
.glide/
15-
.idea/
16-
1710
# make build output
18-
eksctl
1911
cfn_templates.go

.goreleaser.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
builds:
2+
- main: ./cmd/eksctl
3+
binary: eksctl
4+
goos:
5+
- windows
6+
- darwin
7+
- linux
8+
goarch:
9+
- amd64
10+

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
COMMIT:=$(shell git describe --dirty --always)
2+
13
build: update-bindata
2-
go build ./cmd/eksctl
4+
go build -ldflags "-X main.commit=$(COMMIT)" ./cmd/eksctl
35

46
update-bindata:
57
go generate ./pkg/eks

cmd/eksctl/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ func main() {
3636
}
3737

3838
func addCommands() {
39+
rootCmd.AddCommand(versionCmd())
3940
rootCmd.AddCommand(createCmd())
4041
rootCmd.AddCommand(deleteCmd())
4142
}

cmd/eksctl/version.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/spf13/cobra"
7+
)
8+
9+
var (
10+
version = "dev"
11+
commit = "none"
12+
date = "unknown"
13+
)
14+
15+
func versionCmd() *cobra.Command {
16+
return &cobra.Command{
17+
Use: "version",
18+
Short: "Output the version of eksctl",
19+
RunE: func(cmd *cobra.Command, args []string) error {
20+
fmt.Println(fmt.Sprintf("%v, commit %v, built at %v", version, commit, date))
21+
return nil
22+
},
23+
}
24+
}

0 commit comments

Comments
 (0)