Skip to content

Commit

Permalink
Add version string
Browse files Browse the repository at this point in the history
  • Loading branch information
halacs committed Jan 11, 2024
1 parent 8b3e591 commit 55b2395
Show file tree
Hide file tree
Showing 20 changed files with 66 additions and 29 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ jobs:
- uses: actions/checkout@v3
- uses: wangyoucao577/go-release-action@v1
with:
binary_name: "halsecure"
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
#extra_files: LICENSE README.md
ldflags: "-X 'bisecur/cli/cmd.Version=${{ github.ref_name }}'"
#extra_files: LICENSE README.md
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ test-short:
go test ${VENDOR} -race -short

build: env
CGO_ENABLED=0 go build -v -o ${DIST}${APPNAME} .
CGO_ENABLED=0 go build -ldflags "-X 'bisecur/cli/cmd.Version=${GITHUB_REF_NAME}'" -v -o ${DIST}${APPNAME} .
2 changes: 1 addition & 1 deletion cli/cmd/discover.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
"bisecure/sdk"
"bisecur/sdk"
"context"
"os"
"time"
Expand Down
4 changes: 2 additions & 2 deletions cli/cmd/getName.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package cmd

import (
"bisecure/cli"
"bisecure/sdk"
"bisecur/cli"
"bisecur/sdk"
"github.com/spf13/viper"
"os"

Expand Down
4 changes: 2 additions & 2 deletions cli/cmd/groups.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package cmd

import (
"bisecure/cli"
"bisecure/sdk"
"bisecur/cli"
"bisecur/sdk"
"github.com/spf13/viper"
"os"

Expand Down
4 changes: 2 additions & 2 deletions cli/cmd/login.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package cmd

import (
"bisecure/cli"
"bisecure/sdk"
"bisecur/cli"
"bisecur/sdk"
"fmt"
"github.com/spf13/cobra"
"github.com/spf13/viper"
Expand Down
4 changes: 2 additions & 2 deletions cli/cmd/logout.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package cmd

import (
"bisecure/cli"
"bisecure/sdk"
"bisecur/cli"
"bisecur/sdk"
"fmt"
"github.com/spf13/viper"
"os"
Expand Down
4 changes: 2 additions & 2 deletions cli/cmd/ping.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package cmd

import (
"bisecure/cli"
"bisecure/sdk"
"bisecur/cli"
"bisecur/sdk"
"github.com/spf13/viper"
"os"

Expand Down
4 changes: 2 additions & 2 deletions cli/cmd/setState.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package cmd

import (
"bisecure/cli"
"bisecure/sdk"
"bisecur/cli"
"bisecur/sdk"
"github.com/spf13/viper"
"os"

Expand Down
6 changes: 3 additions & 3 deletions cli/cmd/status.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package cmd

import (
"bisecure/cli"
"bisecure/sdk"
"bisecure/sdk/payload"
"bisecur/cli"
"bisecur/sdk"
"bisecur/sdk/payload"
"github.com/spf13/viper"
"os"

Expand Down
4 changes: 2 additions & 2 deletions cli/cmd/users.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package cmd

import (
"bisecure/cli"
"bisecure/sdk"
"bisecur/cli"
"bisecur/sdk"
"github.com/spf13/viper"
"os"

Expand Down
35 changes: 35 additions & 0 deletions cli/cmd/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package cmd

import (
"fmt"

"github.com/spf13/cobra"
)

var (
Version string
)

// versionCmd represents the version command
var versionCmd = &cobra.Command{
Use: "version",
Short: "",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("Version: %s\n", Version)
},
}

func init() {
rootCmd.AddCommand(versionCmd)

// Here you will define your flags and configuration settings.

// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// versionCmd.PersistentFlags().String("foo", "", "A help for foo")

// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// versionCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module bisecure
module bisecur

go 1.21

Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package main

import "bisecure/cli/cmd"
import "bisecur/cli/cmd"

func main() {
cmd.Execute()
Expand Down
2 changes: 1 addition & 1 deletion sdk/Client.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package sdk

import (
"bisecure/sdk/payload"
"bisecur/sdk/payload"
"bytes"
"fmt"
"github.com/sirupsen/logrus"
Expand Down
2 changes: 1 addition & 1 deletion sdk/Packet.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package sdk

import (
"bisecure/sdk/payload"
"bisecur/sdk/payload"
"bytes"
"encoding/binary"
"encoding/hex"
Expand Down
2 changes: 1 addition & 1 deletion sdk/Packet_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package sdk

import (
"bisecure/sdk/payload"
"bisecur/sdk/payload"
"bytes"
"encoding/hex"
"testing"
Expand Down
4 changes: 2 additions & 2 deletions sdk/TransmissionContainer_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package sdk

import (
"bisecure/sdk/payload"
"bisecure/sdk/payload/hcp"
"bisecur/sdk/payload"
"bisecur/sdk/payload/hcp"
"bytes"
"testing"
)
Expand Down
2 changes: 1 addition & 1 deletion sdk/payload/HmGetTransitionResponse.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package payload

import (
"bisecure/sdk/payload/hcp"
"bisecur/sdk/payload/hcp"
"bytes"
"encoding/binary"
"encoding/hex"
Expand Down
2 changes: 1 addition & 1 deletion sdk/payload/HmGetTransitionResponse_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package payload

import (
"bisecure/sdk/payload/hcp"
"bisecur/sdk/payload/hcp"
"encoding/hex"
"testing"
"time"
Expand Down

0 comments on commit 55b2395

Please sign in to comment.