Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Adding ability to set a version of the provider #2

Merged
merged 1 commit into from
Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ builds:
- arm64
binary: registrygen
main: ./main.go
ldflags: -X github.com/pulumi/registrygen/pkg/version.Version={{.Version}}
archives:
- name_template: "{{ .Binary }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}"
format_overrides:
Expand Down
2 changes: 2 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/pulumi/pulumi/sdk/v3/go/common/util/logging"
"github.com/pulumi/registrygen/cmd/docs"
"github.com/pulumi/registrygen/cmd/metadata"
"github.com/pulumi/registrygen/cmd/version"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -33,6 +34,7 @@ func RootCmd() *cobra.Command {

rootCmd.AddCommand(docs.ResourceDocsCmd())
rootCmd.AddCommand(metadata.PackageMetadataCmd())
rootCmd.AddCommand(version.Command())

return rootCmd
}
21 changes: 21 additions & 0 deletions cmd/version/cli.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package version

import (
"fmt"

cliVersion "github.com/pulumi/registrygen/pkg/version"
"github.com/spf13/cobra"
)

func Command() *cobra.Command {
command := &cobra.Command{
Use: "version",
Short: "Get the current version",
Long: `Get the current version of pulumictl`,
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println(cliVersion.Version)
return nil
},
}
return command
}
4 changes: 4 additions & 0 deletions pkg/version/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package version

// Version is the version of this tool.
var Version string