Skip to content

Commit

Permalink
support official Go versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
kendavis2 committed Mar 6, 2020
1 parent 8678153 commit 822bbb3
Show file tree
Hide file tree
Showing 10 changed files with 164 additions and 16 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
working-directory: ./v4
steps:
- uses: olegtarasov/get-tag@v1
id: tagName
Expand All @@ -24,6 +26,7 @@ jobs:
uses: actions/checkout@v2

- name: Run Tests
working-directory: ${{env.working-directory}}
run: go test ./...

- name: Build and Publish Code
Expand All @@ -32,7 +35,7 @@ jobs:
GOROOT: /usr/local/go
with:
args: |
cd cli
cd ${{env.working-directory}}/cli
gox -os='linux' -os='windows' -ldflags '-X main.version=${{ steps.tagName.outputs.tag }}.${{ github.run_number }}' -output 'artifacts/cstore_{{.OS}}_{{.Arch}}'
ghr -t '${{ secrets.GITHUB_TOKEN }}' -u turnerlabs -r cstore -c $GITHUB_SHA -delete ${{ steps.tagName.outputs.tag }} artifacts
2 changes: 1 addition & 1 deletion docs/LIBRARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"log"
"os"

"github.com/turnerlabs/cstore"
"github.com/turnerlabs/cstore/v4"
)

config, err := cstore.Pull(os.Getenv("CSTORE_CATALOG"),
Expand Down
2 changes: 1 addition & 1 deletion docs/PUBLISH.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ NOTE: semver tag format required `v1.0.0-rc`
```bash
$ git tag {{TAG}}
$ git push origin {{TAG}}
$ ./create_darwin_build.sh
$ ./{{MAJOR_VERSION_NUMBER}}/create_darwin_build.sh
```
Once the build is complete the {{TAG}} release will be published to GitHub.

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/subosito/gotenv v1.2.0
github.com/tidwall/gjson v1.6.0
github.com/tidwall/sjson v1.0.4
github.com/turnerlabs/cstore/v4 v4.0.0-20200305155425-65deccbd3934 // indirect
github.com/turnerlabs/cstore/v4 v4.0.0 // indirect
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073
gopkg.in/yaml.v2 v2.2.8
)
9 changes: 2 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
Expand Down Expand Up @@ -82,7 +80,6 @@ github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=
Expand Down Expand Up @@ -119,7 +116,6 @@ github.com/spf13/viper v1.6.2/go.mod h1:t3iDnF5Jlj76alVNuyFBk5oUMCvsrkbvZK0WQdfD
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
Expand All @@ -132,9 +128,8 @@ github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhV
github.com/tidwall/sjson v1.0.4 h1:UcdIRXff12Lpnu3OLtZvnc03g4vH2suXDXhBwBqmzYg=
github.com/tidwall/sjson v1.0.4/go.mod h1:bURseu1nuBkFpIES5cz6zBtjmYeOQmEESshn7VpF15Y=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/turnerlabs/cstore v3.1.0-alpha+incompatible/go.mod h1:ny3OdebjGICnMZDEOzQE9YgSTmWY1XV3Mngm4xsDcKI=
github.com/turnerlabs/cstore/v4 v4.0.0-20200305155425-65deccbd3934 h1:e+qxcX8LjSR9iUsYw2YImCd85o7Lh46MOaLe/Kw3S1Q=
github.com/turnerlabs/cstore/v4 v4.0.0-20200305155425-65deccbd3934/go.mod h1:HaSKfRFkDrDkd2hCKfqXIiddZ+6KLylkA1skE3rUN8M=
github.com/turnerlabs/cstore/v4 v4.0.0 h1:cd28jAomnLymAyDP9Vx0NRdg+BbXy2DB5PvoLOwoEwY=
github.com/turnerlabs/cstore/v4 v4.0.0/go.mod h1:F67ddVyI7QqxUWcGYZdKGlEygWg85OhgKk5hzkP5AoQ=
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
Expand Down
8 changes: 5 additions & 3 deletions v4/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ import (
"github.com/turnerlabs/cstore/v4/components/cfg"
)

var version = "v3.0.0-rc"
var version = ""

func main() {
cfg.Version = version

if len(version) > 0 {
cfg.Version = version
}

if err := cmd.RootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(-1)
Expand Down
4 changes: 2 additions & 2 deletions v4/components/cfg/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package cfg

// Version is overridden by the main function unless tests
// which require a default are running.
var Version = "v3.0.0-default"
var Version = "v4.0.0-default"

// SupportedVersions ...
var SupportedVersions = []string{"v2", Version}
var SupportedVersions = []string{"v2", "v3", Version}
6 changes: 6 additions & 0 deletions v4/create_darwin_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
read -p 'Git Tag: ' VERSION_NUM
read -p 'GitHub Actions Build #: ' BUILD_NUM

cd cli

go build -ldflags "-X main.version=$VERSION_NUM.$BUILD_NUM" -o ../cstore_darwin_amd64
3 changes: 3 additions & 0 deletions v4/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ require (
github.com/aws/aws-sdk-go v1.29.18
github.com/fatih/color v1.9.0
github.com/keybase/go-keychain v0.0.0-20200218013740-86d4642e4ce2
github.com/mattn/go-colorable v0.1.4
github.com/mitchellh/go-homedir v1.1.0
github.com/satori/go.uuid v1.2.0
github.com/spf13/cobra v0.0.6
github.com/spf13/viper v1.6.2
github.com/subosito/gotenv v1.2.0
github.com/tidwall/gjson v1.6.0
github.com/tidwall/sjson v1.0.4
Expand Down
Loading

0 comments on commit 822bbb3

Please sign in to comment.