Skip to content

Commit

Permalink
Add gorelease to CI, version command
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanprodan authored and errordeveloper committed Jun 5, 2018
1 parent 0c84bb5 commit 98496b1
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 9 deletions.
27 changes: 27 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,30 @@ jobs:
- setup_remote_docker: {docker_layer_caching: true}
# just a simple build for now, but will use skaffold if it gets more complex
- run: docker build .
deploy:
docker:
- image: circleci/golang:1.10
working_directory: /go/src/github.com/weaveworks/eksctl
steps:
- checkout
- setup_remote_docker: {docker_layer_caching: true}
- run: make install-bindata
- run: make update-bindata
- run:
name: Build and publish
command: |
if [[ -z "${CIRCLE_PULL_REQUEST}" ]] && [[ "${CIRCLE_TAG}" ]] && [[ "${CIRCLE_PROJECT_USERNAME}" = "weaveworks" ]] ; then
curl -sL https://git.io/goreleaser | bash
else
echo "No deploy on PR"
fi
workflows:
version: 2
build-and-deploy:
jobs:
- build
- deploy:
filters:
tags:
only: /^[0-9].*/
8 changes: 0 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,5 @@
# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
.glide/
.idea/

# make build output
eksctl
cfn_templates.go
10 changes: 10 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
builds:
- main: ./cmd/eksctl
binary: eksctl
goos:
- windows
- darwin
- linux
goarch:
- amd64

4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
COMMIT:=$(shell git describe --dirty --always)

build: update-bindata
go build ./cmd/eksctl
go build -ldflags "-X main.commit=$(COMMIT)" ./cmd/eksctl

update-bindata:
go generate ./pkg/eks
Expand Down
1 change: 1 addition & 0 deletions cmd/eksctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func main() {
}

func addCommands() {
rootCmd.AddCommand(versionCmd())
rootCmd.AddCommand(createCmd())
rootCmd.AddCommand(deleteCmd())
}
24 changes: 24 additions & 0 deletions cmd/eksctl/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package main

import (
"fmt"

"github.com/spf13/cobra"
)

var (
version = "dev"
commit = "none"
date = "unknown"
)

func versionCmd() *cobra.Command {
return &cobra.Command{
Use: "version",
Short: "Output the version of eksctl",
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println(fmt.Sprintf("%v, commit %v, built at %v", version, commit, date))
return nil
},
}
}

0 comments on commit 98496b1

Please sign in to comment.