diff --git a/runtime-watcher/.goreleaser.yml b/runtime-watcher/.goreleaser.yml new file mode 100644 index 00000000..e7d3434a --- /dev/null +++ b/runtime-watcher/.goreleaser.yml @@ -0,0 +1,60 @@ +# Documentation for how to configure goreleaser can be found at http://goreleaser.com +project_name: kyma +release: + github: + owner: kyma-project + name: runtime-watcher + prerelease: auto +before: + hooks: + - make resolve +builds: + - env: + - CGO_ENABLED=0 + main: ./runtime-watcher/ + goos: + - darwin + - linux + - windows + ignore: + - goos: darwin + goarch: 386 +archives: + - id: foo + name_template: >- + {{ .ProjectName }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + format_overrides: + - goos: windows + format: zip +checksum: + name_template: "checksums.txt" +snapshot: + name_template: "{{ .Tag }}-next" +changelog: + use: github + sort: asc + groups: + - title: Bug fixes + regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$' + order: 1 + - title: Dependencies + regexp: '^.*?deps(\([[:word:]]+\))??!?:.+$' + order: 2 + - title: Documentation + regexp: '^.*?docs(\([[:word:]]+\))??!?:.+$' + order: 3 + - title: Test suites + regexp: '^.*?test(\([[:word:]]+\))??!?:.+$' + order: 4 + - title: Features + order: 0 + filters: + exclude: + - "^docs:" + - "^test:" + - '^(B|b)ump' + - '^.*?chore(\([[:word:]]+\))??!?:.+$' diff --git a/runtime-watcher/Makefile b/runtime-watcher/Makefile index 22d15d87..6ddadb83 100644 --- a/runtime-watcher/Makefile +++ b/runtime-watcher/Makefile @@ -108,3 +108,10 @@ $(ENVTEST): $(LOCALBIN) lint: ## Run golangci-lint against code. GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANG_CI_LINT_VERSION) $(LOCALBIN)/golangci-lint run -v -c .golangci.yaml + +.PHONY: release +release: + ./hack/release.sh + +.PHONY: ci-release +ci-release: resolve build test release diff --git a/runtime-watcher/hack/release.sh b/runtime-watcher/hack/release.sh new file mode 100755 index 00000000..3fb81c54 --- /dev/null +++ b/runtime-watcher/hack/release.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +# standard bash error handling +set -o nounset # treat unset variables as an error and exit immediately. +set -o errexit # exit immediately when a command fails. +set -E # needs to be set if we want the ERR trap + +get_new_release_version() { + # get the list of tags in a reverse chronological order + TAG_LIST=($(git tag --sort=-creatordate)) + export GORELEASER_CURRENT_TAG=${TAG_LIST[0]} +} + +get_previous_release_version() { + # get the list of tags in a reverse chronological order excluding release candidate tags + TAG_LIST_WITHOUT_RC=($(git tag --sort=-creatordate | grep -v -e "-rc")) + if [[ $GORELEASER_CURRENT_TAG == *"-rc"* ]]; then + export GORELEASER_PREVIOUS_TAG=${TAG_LIST_WITHOUT_RC[0]} + else + export GORELEASER_PREVIOUS_TAG=${TAG_LIST_WITHOUT_RC[1]} + fi +} + +main() { + git remote add origin git@github.com:kyma-project/runtime-watcher.git + get_new_release_version + get_previous_release_version + # release watcher with release notes generated by goreleaser + curl -sL https://git.io/goreleaser | VERSION=v0.0.1-test1 bash -s -- +} + +main