From db3df42d65a7603f9039fe6a5a5cae4d69ecceeb Mon Sep 17 00:00:00 2001 From: Francis Gallagher Date: Fri, 24 Nov 2023 12:55:31 +0000 Subject: [PATCH 1/5] fix: add version command properly --- .github/workflows/release-please.yml | 2 ++ README.md | 2 ++ main.go | 14 ++++++++++++-- version.txt | 1 + 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 version.txt diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 834254d..6b6579f 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -16,6 +16,8 @@ jobs: token: ${{ secrets.PAT_TOKEN }} release-type: go package-name: "MageComm" + extra-files: | + version.txt - name: Log release info run: | diff --git a/README.md b/README.md index 79062cc..4d69105 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,8 @@ config file can be in yaml or json format e.g `config.yml` or `config.json`, ple Download the latest release from the [releases page](https://github.com/furan917/magecomm/releases) for your platform and extract to a directory in your PATH. +Then check your installed version with `magecomm version` + example config.yml: ``` disallow_configfile_overwrite: true diff --git a/main.go b/main.go index 4efa9dc..406b5cf 100644 --- a/main.go +++ b/main.go @@ -1,20 +1,25 @@ package main import ( + _ "embed" + "fmt" "github.com/spf13/cobra" "magecomm/cmd" "magecomm/config_manager" "magecomm/logger" "magecomm/notifictions" "magecomm/services" + "os" "strings" ) +//go:embed version.txt +var version string + var RootCmd = &cobra.Command{ Use: "magecomm", Short: "MageComm CLI is a command line tool for managing Magento applications", PersistentPreRun: func(cmd *cobra.Command, args []string) { - debug, _ := cmd.Flags().GetBool("debug") if debug { logger.EnableDebugMode() @@ -33,11 +38,16 @@ func initializeModuleWhichRequireConfig() { } func main() { + if len(os.Args) > 1 && os.Args[1] == "version" { + fmt.Printf("Magecomm Version: %s\n", strings.TrimSpace(version)) + return + } + RootCmd.AddCommand(cmd.ListenCmd) RootCmd.AddCommand(cmd.MagerunCmd) - //RootCmd.AddCommand(cmd.DeployCmd) RootCmd.AddCommand(cmd.CatCmd) //RootCmd.AddCommand(cmd.CatDeployCmd) + //RootCmd.AddCommand(cmd.DeployCmd) RootCmd.PersistentFlags().String("config", "", "Path to config file") RootCmd.PersistentFlags().Bool("debug", false, "Enable debug mode") diff --git a/version.txt b/version.txt new file mode 100644 index 0000000..f68b119 --- /dev/null +++ b/version.txt @@ -0,0 +1 @@ +v0.1.10 \ No newline at end of file From b31cc8d9c0641913fe134a24f543f6478251fb26 Mon Sep 17 00:00:00 2001 From: Francis Gallagher Date: Fri, 24 Nov 2023 12:57:33 +0000 Subject: [PATCH 2/5] fix: Add release pleas comment to version file --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index f68b119..47b7329 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -v0.1.10 \ No newline at end of file +v0.1.10 ## x-release-please-version \ No newline at end of file From e79e230ea70d70069517f79072cc5cba7e59a0da Mon Sep 17 00:00:00 2001 From: Francis Gallagher Date: Fri, 24 Nov 2023 13:05:13 +0000 Subject: [PATCH 3/5] fix: ensure version output is displayed without comment --- main.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.go b/main.go index 406b5cf..74adb1e 100644 --- a/main.go +++ b/main.go @@ -39,6 +39,8 @@ func initializeModuleWhichRequireConfig() { func main() { if len(os.Args) > 1 && os.Args[1] == "version" { + //Remove the release me comment from the version output + version = strings.Split(version, "##")[0] fmt.Printf("Magecomm Version: %s\n", strings.TrimSpace(version)) return } From 622650d0f56e05e57a767cc5fa8b07ac1d07aae2 Mon Sep 17 00:00:00 2001 From: Francis Date: Fri, 24 Nov 2023 13:05:36 +0000 Subject: [PATCH 4/5] chore(main): release 0.1.11 --- CHANGELOG.md | 9 +++++++++ version.txt | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd8007c..ce3f3ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## [0.1.11](https://github.com/furan917/MageComm/compare/v0.1.10...v0.1.11) (2023-11-24) + + +### Bug Fixes + +* Add release pleas comment to version file ([b31cc8d](https://github.com/furan917/MageComm/commit/b31cc8d9c0641913fe134a24f543f6478251fb26)) +* add version command properly ([db3df42](https://github.com/furan917/MageComm/commit/db3df42d65a7603f9039fe6a5a5cae4d69ecceeb)) +* ensure version output is displayed without comment ([e79e230](https://github.com/furan917/MageComm/commit/e79e230ea70d70069517f79072cc5cba7e59a0da)) + ## [0.1.10](https://github.com/furan917/MageComm/compare/v0.1.9...v0.1.10) (2023-11-23) diff --git a/version.txt b/version.txt index 47b7329..113d530 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -v0.1.10 ## x-release-please-version \ No newline at end of file +v0.1.11 ## x-release-please-version \ No newline at end of file From 5060a6bb0c9fa6c7998a2a4e5ac0829d8ba39612 Mon Sep 17 00:00:00 2001 From: Francis Date: Fri, 24 Nov 2023 13:12:50 +0000 Subject: [PATCH 5/5] chore: fixed comment with dyslexia mixup --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 74adb1e..ef889c9 100644 --- a/main.go +++ b/main.go @@ -39,7 +39,7 @@ func initializeModuleWhichRequireConfig() { func main() { if len(os.Args) > 1 && os.Args[1] == "version" { - //Remove the release me comment from the version output + //Remove the release-please comment from the version output version = strings.Split(version, "##")[0] fmt.Printf("Magecomm Version: %s\n", strings.TrimSpace(version)) return