diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2b26221 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +name: 'ci' + +on: + push: + branches: + - main + pull_request: + +jobs: + docs: + name: docs + runs-on: ubuntu-latest + strategy: + matrix: + go: [ '1.17' ] + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 1 + - name: Restore Cache + uses: actions/cache@v3 + id: cache + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - uses: actions/setup-go@v3 + with: + go-version: ${{ matrix.go }} + - name: Build docs + run: make generate-docs + - name: Detect Uncommitted Docs + run: git diff --exit-code docs diff --git a/.goreleaser.yml b/.goreleaser.yml index 0a0ed69..7fc53e0 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -13,8 +13,6 @@ builds: binary: cherryctl ldflags: - -X github.com/cherryservers/cherryctl/cmd.Version={{.Version}} - - -X github.com/cherryservers/cherryctl/cmd.Build=${.Commit}" - goos: - linux - windows diff --git a/cmd/root.go b/cmd/root.go index 80c1daa..9466248 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -24,10 +24,13 @@ import ( "github.com/spf13/cobra" ) +var ( + Version string = "dev" +) + const ( apiTokenEnvVar = "CHERRY_AUTH_TOKEN" apiURL = "https://api.cherryservers.com/v1/" - version = "dev" ) type Cli struct { @@ -40,7 +43,7 @@ func NewCli() *Cli { Outputer: &outputs.Standard{}, } - rootClient := root.NewClient(os.Getenv(apiTokenEnvVar), apiURL, version) + rootClient := root.NewClient(os.Getenv(apiTokenEnvVar), apiURL, Version) rootCmd := rootClient.NewCommand() rootCmd.DisableSuggestions = false cli.MainCmd = rootCmd