From f40df161c7001a9917e2875a92f40f0bce9a56e7 Mon Sep 17 00:00:00 2001 From: Nathaniel Salawe Date: Fri, 13 Sep 2024 15:27:03 +0100 Subject: [PATCH 1/7] Create releaser.yml --- .github/workflows/releaser.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/releaser.yml diff --git a/.github/workflows/releaser.yml b/.github/workflows/releaser.yml new file mode 100644 index 0000000..91a0b2b --- /dev/null +++ b/.github/workflows/releaser.yml @@ -0,0 +1,31 @@ +name: goreleaser + +on: + push: + tags: + - "*" + +permissions: + contents: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: stable + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v6 + with: + distribution: goreleaser + version: "~> v2" + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From a6f598f478722b755b3e304de355ebe4a7bf45d9 Mon Sep 17 00:00:00 2001 From: Nathaniel Salawe Date: Fri, 13 Sep 2024 15:27:23 +0100 Subject: [PATCH 2/7] Delete .github/workflows/goreleaser --- .github/workflows/goreleaser | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 .github/workflows/goreleaser diff --git a/.github/workflows/goreleaser b/.github/workflows/goreleaser deleted file mode 100644 index 91a0b2b..0000000 --- a/.github/workflows/goreleaser +++ /dev/null @@ -1,31 +0,0 @@ -name: goreleaser - -on: - push: - tags: - - "*" - -permissions: - contents: write - -jobs: - goreleaser: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: stable - - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v6 - with: - distribution: goreleaser - version: "~> v2" - args: release --clean - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 328e388a11ec39b1742d0139ae40b0fd440879d4 Mon Sep 17 00:00:00 2001 From: Nathan-Salawe Date: Fri, 13 Sep 2024 16:27:59 +0100 Subject: [PATCH 3/7] src dir --- .github/workflows/releaser.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/releaser.yml b/.github/workflows/releaser.yml index 91a0b2b..bb6070a 100644 --- a/.github/workflows/releaser.yml +++ b/.github/workflows/releaser.yml @@ -16,16 +16,20 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Set up Go uses: actions/setup-go@v5 with: go-version: stable - - name: Run GoReleaser + - name: Install GoReleaser uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser version: "~> v2" - args: release --clean + + - name: Run GoReleaser + run: goreleaser release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + working-directory: /src From cd116c9968a93a204f25138d433153074be75ab6 Mon Sep 17 00:00:00 2001 From: Nathan-Salawe Date: Fri, 13 Sep 2024 16:31:05 +0100 Subject: [PATCH 4/7] minor changes --- .github/workflows/releaser.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/releaser.yml b/.github/workflows/releaser.yml index bb6070a..3441a07 100644 --- a/.github/workflows/releaser.yml +++ b/.github/workflows/releaser.yml @@ -22,14 +22,11 @@ jobs: with: go-version: stable - - name: Install GoReleaser + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser version: "~> v2" - - - name: Run GoReleaser - run: goreleaser release --clean + args: help env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - working-directory: /src From de017334bffa8b0643f85e545310af268ed29ab6 Mon Sep 17 00:00:00 2001 From: Nathan-Salawe Date: Fri, 13 Sep 2024 16:34:03 +0100 Subject: [PATCH 5/7] minor changes --- .github/workflows/releaser.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/releaser.yml b/.github/workflows/releaser.yml index 3441a07..9128d18 100644 --- a/.github/workflows/releaser.yml +++ b/.github/workflows/releaser.yml @@ -22,11 +22,15 @@ jobs: with: go-version: stable - - name: Run GoReleaser + - name: Install GoReleaser uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser version: "~> v2" args: help + + - name: Run GoReleaser + working-directory: /src + run: goreleaser release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 38655bdd00806413d671709fa44142ac263c7a52 Mon Sep 17 00:00:00 2001 From: Nathan-Salawe Date: Fri, 13 Sep 2024 16:40:17 +0100 Subject: [PATCH 6/7] go releaser --- .github/workflows/releaser.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/releaser.yml b/.github/workflows/releaser.yml index 9128d18..53d6292 100644 --- a/.github/workflows/releaser.yml +++ b/.github/workflows/releaser.yml @@ -27,10 +27,7 @@ jobs: with: distribution: goreleaser version: "~> v2" - args: help - - - name: Run GoReleaser - working-directory: /src - run: goreleaser release --clean + args: release --clean + workdir: src env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 93944374c89ad80d9e89a29fa1f3ec5387320ec3 Mon Sep 17 00:00:00 2001 From: Nathan-Salawe Date: Fri, 13 Sep 2024 17:40:45 +0100 Subject: [PATCH 7/7] version command --- src/cmd/root.go | 1 + src/cmd/version.go | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/cmd/version.go diff --git a/src/cmd/root.go b/src/cmd/root.go index a708aad..b2ba467 100644 --- a/src/cmd/root.go +++ b/src/cmd/root.go @@ -37,6 +37,7 @@ func addSubCommandPallets() { rootCmd.AddCommand(deploy.DeployCmd) rootCmd.AddCommand(info.InfoCmd) rootCmd.AddCommand(open.OpenCmd) + rootCmd.AddCommand(VersionCmd) } func init() { diff --git a/src/cmd/version.go b/src/cmd/version.go new file mode 100644 index 0000000..72d8252 --- /dev/null +++ b/src/cmd/version.go @@ -0,0 +1,21 @@ +/* +Copyright © 2024 MavenCode +*/ +package cmd + +import ( + "fmt" + + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +// rootCmd represents the base command when called without any subcommands +var VersionCmd = &cobra.Command{ + Use: "version", + Short: "Get current beamstack version", + Long: ``, + Run: func(cmd *cobra.Command, args []string) { + fmt.Println(viper.Get("version")) + }, +}