Skip to content

Commit

Permalink
feat(core): Expose version info (#1841)
Browse files Browse the repository at this point in the history
### Proposed Changes

- Adds sdk.Version and sdk.TDFSpecVersion strings for library
integrators to inspect
- Adds `version` subcommand to platform service
- The values should be updated automatically with release please
- Note this means the version of main will be pinned to the last release


### Checklist

- [ ] I have added or updated unit tests
- [ ] I have added or updated integration tests (if appropriate)
- [ ] I have added or updated documentation

### Testing Instructions
  • Loading branch information
dmihalcik-virtru authored Jan 8, 2025
1 parent 85ce9b6 commit 92a9f5e
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ toolcheck:
@which buf > /dev/null || (echo "buf not found, please install it from https://docs.buf.build/installation" && exit 1)
@which golangci-lint > /dev/null || (echo "golangci-lint not found, run 'go install github.com/golangci/golangci-lint/cmd/[email protected]'" && exit 1)
@which protoc-gen-doc > /dev/null || (echo "protoc-gen-doc not found, run 'go install github.com/pseudomuto/protoc-gen-doc/cmd/[email protected]'" && exit 1)
@golangci-lint --version | grep "version v\?1.61" > /dev/null || (echo "golangci-lint version must be v1.61 or later [$$(golangci-lint --version)]" && exit 1)
@golangci-lint --version | grep "version v\?1.6[123]" > /dev/null || (echo "golangci-lint version must be v1.61 or later [$$(golangci-lint --version)]" && exit 1)
@which goimports >/dev/null || (echo "goimports not found, run 'go install golang.org/x/tools/cmd/goimports@latest'")

fix: tidy fmt
Expand Down
16 changes: 14 additions & 2 deletions release-please.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,22 @@
"component": "protocol/go"
},
"sdk": {
"component": "sdk"
"component": "sdk",
"extra-files": [
{
"type": "generic",
"path": "sdk/version.go"
}
]
},
"service": {
"component": "service"
"component": "service",
"extra-files": [
{
"type": "generic",
"path": "service/cmd/version.go"
}
]
}
}
}
6 changes: 6 additions & 0 deletions sdk/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package sdk

const (
Version = "0.3.23" // SDK version // x-release-please-version
TDFSpecVersion = "4.2.2" // Vesion of TDF Spec currently targeted by the SDK
)
16 changes: 16 additions & 0 deletions service/cmd/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package cmd

import "github.com/spf13/cobra"

const Version = "0.4.36" // Service Version // x-release-please-version

func init() {
rootCmd.AddCommand(&cobra.Command{
Use: "version",
Short: "Platform version information",
RunE: func(cmd *cobra.Command, _ []string) error {
cmd.Println(Version)
return nil
},
})
}

0 comments on commit 92a9f5e

Please sign in to comment.