Skip to content

Commit

Permalink
* core: figure out a process to autobuild releases - closes #210
Browse files Browse the repository at this point in the history
* cmd: add version command - closes #218
  • Loading branch information
Aeneas Rekkas (arekkas) committed Aug 29, 2016
1 parent 3f80cc9 commit 633f258
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ vendor/
.hydra.yml
cover.out
output/
_book/
_book/
dist/
25 changes: 23 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ go:
- 1.7

install:
- go get github.com/mattn/goveralls golang.org/x/tools/cmd/cover github.com/pierrre/gotestcover github.com/Masterminds/glide
- go get github.com/mattn/goveralls golang.org/x/tools/cmd/cover github.com/pierrre/gotestcover github.com/Masterminds/glide github.com/mitchellh/gox github.com/tcnksm/ghr
- git clone https://github.com/docker-library/official-images.git ~/official-images
- glide install
- go install github.com/ory-am/hydra
Expand All @@ -28,4 +28,25 @@ script:
- docker run -d hydra-travis-ci
- $GOPATH/bin/hydra host --dangerous-auto-logon &
- while ! echo exit | nc localhost 4444; do sleep 1; done
- $GOPATH/bin/hydra token client --skip-tls-verify
- $GOPATH/bin/hydra token client --skip-tls-verify

after_success:
- gox -output "dist/{{.Dir}}-{{.OS}}-{{.Arch}}"
# - ghr --username arekkas --token $GITHUB_TOKEN --replace --prerelease --debug pre-release dist/

deploy:
provider: releases
api_key: $GITHUB_TOKEN
file:
- dist/hydra-darwin-386
- dist/hydra-darwin-amd64
- dist/hydra-freebsd-386
- dist/hydra-freebsd-amd64
- dist/hydra-linux-arm
- dist/hydra-netbsd-arm
- dist/hydra-openbsd-386
- dist/hydra-windows-amd64.exe
skip_cleanup: true
on:
tags: true
go: 1.7
43 changes: 43 additions & 0 deletions cmd/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright © 2016 NAME HERE <EMAIL ADDRESS>
//
// 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"
"time"
)

var (
Version = "dev-master"
BuildTime = time.Now().String()
GitHash = "undefined"
)

// versionCmd represents the version command
var versionCmd = &cobra.Command{
Use: "version",
Short: "Display this binary's version, build time and git hash of this build",
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("Version: %s\n", Version)
fmt.Printf("Git Hash: %s\n", GitHash)
fmt.Printf("Build Time: %s\n", BuildTime)
},
}

func init() {
RootCmd.AddCommand(versionCmd)
}

0 comments on commit 633f258

Please sign in to comment.