File tree 5 files changed +107
-5
lines changed
5 files changed +107
-5
lines changed Original file line number Diff line number Diff line change
1
+ name : release
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - main
7
+ - ' [0-9]+.[0-9]+.x'
8
+ workflow_dispatch :
9
+
10
+ defaults :
11
+ run :
12
+ shell : bash
13
+
14
+ jobs :
15
+ release-please :
16
+ permissions :
17
+ contents : write # for google-github-actions/release-please-action to create release commit
18
+ pull-requests : write # for google-github-actions/release-please-action to create release PR
19
+ runs-on : ubuntu-latest
20
+ outputs :
21
+ releases_created : ${{ steps.release.outputs.releases_created }}
22
+ tag_name : ${{ steps.release.outputs.tag_name }}
23
+ # Release-please creates a PR that tracks all changes
24
+ steps :
25
+ - name : Checkout
26
+ uses : actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
27
+ - uses : google-github-actions/release-please-action@e4dc86ba9405554aeba3c6bb2d169500e7d3b4ee # v4.1.1
28
+ id : release
29
+ with :
30
+ command : manifest
31
+ token : ${{secrets.RELEASE_CREATOR_TOKEN}}
32
+ default-branch : main
33
+
34
+ goreleaser :
35
+ if : needs.release-please.outputs.releases_created == 'true'
36
+ permissions :
37
+ contents : write
38
+ needs :
39
+ - release-please
40
+ runs-on : ubuntu-latest
41
+ steps :
42
+ - name : Checkout
43
+ uses : actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
44
+ with :
45
+ fetch-depth : 0
46
+ - name : Set up Go
47
+ uses : actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5
48
+ with :
49
+ go-version : ' 1.22'
50
+ - name : Run GoReleaser
51
+ uses : goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6
52
+ with :
53
+ # either 'goreleaser' (default) or 'goreleaser-pro'
54
+ distribution : goreleaser
55
+ version : latest
56
+ args : release --clean
57
+ env :
58
+ GITHUB_TOKEN : ${{ secrets.RELEASE_CREATOR_TOKEN }}
Original file line number Diff line number Diff line change 1
1
bin /
2
2
.idea /
3
+
4
+ dist /
Original file line number Diff line number Diff line change
1
+ project_name : kratix-cli
2
+
3
+ version : 2
4
+
5
+ before :
6
+ hooks :
7
+ - go mod tidy
8
+ - go generate ./...
9
+
10
+ builds :
11
+ - env :
12
+ - CGO_ENABLED=0
13
+ goos :
14
+ - linux
15
+ - darwin
16
+ ldflags :
17
+ - -X main.version={{.Version}}
18
+
19
+ archives :
20
+ - format : tar.gz
21
+ name_template : >-
22
+ {{ .ProjectName }}_
23
+ {{- title .Os }}_
24
+ {{- if eq .Arch "amd64" }}x86_64
25
+ {{- else if eq .Arch "386" }}i386
26
+ {{- else }}{{ .Arch }}{{ end }}
27
+ {{- if .Arm }}v{{ .Arm }}{{ end }}
28
+
29
+ changelog :
30
+ sort : asc
31
+ filters :
32
+ exclude :
33
+ - " ^docs:"
34
+ - " ^test:"
35
+ - " ^.github"
36
+ - " ^.circleci"
37
+ - " ^test"
Original file line number Diff line number Diff line change @@ -3,11 +3,12 @@ package cmd
3
3
import (
4
4
"bytes"
5
5
"embed"
6
- "github.com/Masterminds/sprig/v3"
7
- "github.com/spf13/cobra"
8
6
"os"
9
7
"path/filepath"
10
8
"text/template"
9
+
10
+ "github.com/Masterminds/sprig/v3"
11
+ "github.com/spf13/cobra"
11
12
)
12
13
13
14
const filePerm = 0644
@@ -17,13 +18,14 @@ var rootCmd = &cobra.Command{
17
18
Use : "kratix" ,
18
19
Short : "A CLI tool for Kratix" ,
19
20
Long : `A CLI tool for Kratix` ,
20
- Version : "v0.0.1 " ,
21
+ Version : "" ,
21
22
Example : ` # To initialize a new promise
22
23
kratix init promise promise-name --group myorg.com --kind Database
23
24
` ,
24
25
}
25
26
26
- func Execute () {
27
+ func Execute (version string ) {
28
+ rootCmd .Version = version
27
29
err := rootCmd .Execute ()
28
30
if err != nil {
29
31
os .Exit (1 )
Original file line number Diff line number Diff line change @@ -20,6 +20,9 @@ import (
20
20
"github.com/syntasso/kratix-cli/cmd"
21
21
)
22
22
23
+ // set at build time by goreleaser, equal to tag name without the v prefix
24
+ var version = ""
25
+
23
26
func main () {
24
- cmd .Execute ()
27
+ cmd .Execute (version )
25
28
}
You can’t perform that action at this time.
0 commit comments