Skip to content

Commit

Permalink
add versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
jmank88 committed Apr 23, 2019
1 parent 8a15b97 commit 4d90882
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.PHONY: build install test

version=$(shell ./version.sh)

build:
go build -ldflags "-X main.version=${version}" ./cmd/gofs

install:
go install -ldflags "-X main.version=${version}" ./cmd/gofs

test:
go test ./...
17 changes: 11 additions & 6 deletions cmd/gofs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,23 @@ import (
"time"

"github.com/alecthomas/units"

cid "github.com/ipfs/go-cid"

"github.com/gochain-io/gofs"

"github.com/gochain-io/gochain/v3/common"
"github.com/gochain-io/gochain/v3/core/types"
"github.com/gochain-io/gochain/v3/crypto"
"github.com/gochain-io/gofs"
"github.com/gochain-io/web3"
cid "github.com/ipfs/go-cid"
"github.com/urfave/cli"
)

var version string

func init() {
if version == "" {
version = "unknown"
}
}

func main() {
// Interrupt cancellation.
ctx, cancelFn := context.WithCancel(context.Background())
Expand All @@ -41,7 +46,7 @@ func main() {

app := cli.NewApp()
app.Name = "gofs"
app.Version = "0.0.1"
app.Version = version
app.Usage = "GoChain filesystem cli tool"
var api, rpc, contract string
//TODO var recursive bool
Expand Down
2 changes: 2 additions & 0 deletions tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
git tag -f -a "v$1" -m "version $1"
2 changes: 2 additions & 0 deletions version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
git describe --always --dirty

0 comments on commit 4d90882

Please sign in to comment.