diff --git a/.gitignore b/.gitignore index dc877d69..6034e202 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,5 @@ bin **/*.csr **/server-csr.json .DS_Store + +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 00000000..f13f732c --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,57 @@ +before: + hooks: + - go mod tidy +builds: + - + # Binary name + id: "kamaji" + + # Custom environment variables to be set during the builds. + # Invalid environment variables will be ignored. + # + # Default: os.Environ() ++ env config section + # Templates: allowed (since v1.14) + env: + - CGO_ENABLED=0 + + # GOOS list to build for. + # For more info refer to: https://golang.org/doc/install/source#environment + # + # Default: [ 'darwin', 'linux', 'windows' ] + goos: + - linux + - windows + - darwin + + # GOARCH to build for. + # For more info refer to: https://golang.org/doc/install/source#environment + # + # Default: [ '386', 'amd64', 'arm64' ] + goarch: + - amd64 + - arm64 + + # Custom ldflags. + ldflags: "-X github.com/clastix/kamaji/internal.GitRepo=${{.Env.GIT_REPO}} -X github.com/clastix/kamaji/internal.GitTag={{.Env.VERSION}} -X github.com/clastix/kamaji/internal.GitCommit={{.Env.GIT_HEAD_COMMIT}} -X github.com/clastix/kamaji/internal.GitDirty={{.Env.GIT_MODIFIED}} -X github.com/clastix/kamaji/internal.BuildTime={{.Env.BUILD_DATE}}" + +archives: + - format: tar.gz + name_template: >- + {{ .ProjectName }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}amd64 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} + format_overrides: + - goos: windows + format: zip +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ incpatch .Version }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' diff --git a/Makefile b/Makefile index f0b117b6..a45c10d0 100644 --- a/Makefile +++ b/Makefile @@ -171,6 +171,16 @@ docker-build: ## Build docker image with the manager. docker-push: ## Push docker image with the manager. docker push ${IMG} +create-tag: + @git tag -a v$(VERSION) -m "Welcome to kamoji version $(VERSION)" + @git push origin v$(VERSION) + +# If GITHUB_TOKEN exists, release a version according to the current tag. +# e.g make release VERSION=0.4.0 +# e.g export VERSION=0.0.2 & make release +release: create-tag + goreleaser release --clean + ##@ Deployment metallb: diff --git a/api/v1alpha1/groupversion_info.go b/api/v1alpha1/groupversion_info.go index 5fcb8603..0084afa3 100644 --- a/api/v1alpha1/groupversion_info.go +++ b/api/v1alpha1/groupversion_info.go @@ -4,7 +4,7 @@ // Package v1alpha1 contains API Schema definitions for the kamaji v1alpha1 API group // +kubebuilder:object:generate=true // +groupName=kamaji.clastix.io -//nolint +// nolint package v1alpha1 import (