diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 38244ab..98b7e61 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -18,6 +18,8 @@ jobs: token: ${{ secrets.PAT_TOKEN }} release-type: go package-name: "MageComm" + extra-files: | + version.txt - name: Log release info run: | 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/README.md b/README.md index 8e81ae4..e6cf96c 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,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..ef889c9 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,18 @@ func initializeModuleWhichRequireConfig() { } func main() { + if len(os.Args) > 1 && os.Args[1] == "version" { + //Remove the release-please comment from the version output + version = strings.Split(version, "##")[0] + 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..113d530 --- /dev/null +++ b/version.txt @@ -0,0 +1 @@ +v0.1.11 ## x-release-please-version \ No newline at end of file