From cc03e4a10cd74c7577394389dcd1b48d4c7a827a Mon Sep 17 00:00:00 2001 From: Dom Del Nano Date: Tue, 4 Jun 2024 22:46:35 -0700 Subject: [PATCH] Ensure version package exists and matches existing linker variable on release Signed-off-by: Dom Del Nano --- main.go | 16 +--------------- version/version.go | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 15 deletions(-) create mode 100644 version/version.go diff --git a/main.go b/main.go index 59c7d0f..29dec63 100644 --- a/main.go +++ b/main.go @@ -11,25 +11,11 @@ import ( "github.com/hashicorp/packer-plugin-sdk/version" ) -var ( - // Version is the main version number that is being run at the moment. - Version = "v0.6.0" - - // VersionPrerelease is A pre-release marker for the Version. If this is "" - // (empty string) then it means that it is a final release. Otherwise, this - // is a pre-release such as "dev" (in development), "beta", "rc1", etc. - VersionPrerelease = "" - - // PluginVersion is used by the plugin set to allow Packer to recognize - // what version this plugin is. - PluginVersion = version.InitializePluginVersion(Version, VersionPrerelease) -) - func main() { pps := plugin.NewSet() pps.RegisterBuilder("iso", new(iso.Builder)) pps.RegisterBuilder("xva", new(xva.Builder)) - pps.SetVersion(PluginVersion) + pps.SetVersion(version.PluginVersion) err := pps.Run() if err != nil { fmt.Fprintln(os.Stderr, err.Error()) diff --git a/version/version.go b/version/version.go new file mode 100644 index 0000000..7b54e9c --- /dev/null +++ b/version/version.go @@ -0,0 +1,19 @@ +package version + +import ( + "github.com/hashicorp/packer-plugin-sdk/version" +) + +var ( + // Version is the main version number that is being run at the moment. + Version = "v0.6.0" + + // VersionPrerelease is A pre-release marker for the Version. If this is "" + // (empty string) then it means that it is a final release. Otherwise, this + // is a pre-release such as "dev" (in development), "beta", "rc1", etc. + VersionPrerelease = "dev" + + // PluginVersion is used by the plugin set to allow Packer to recognize + // what version this plugin is. + PluginVersion = version.InitializePluginVersion(Version, VersionPrerelease) +)