diff --git a/Makefile b/Makefile index 59cd6fb..ecd25d9 100644 --- a/Makefile +++ b/Makefile @@ -47,6 +47,10 @@ test: .PHONY: dist dist: $(GORELEASER) $(GOMPLATE) $(GORELEASER) release --rm-dist --skip-publish --snapshot + $(MAKE) manifest + +.PHONY: manifest +manifest: GIT_VERSION=$(GIT_VERSION) $(GOMPLATE) -f ./hack/sort-manifests.yaml.tmpl > $(DIST_DIR)/sort-manifests.yaml .PHONY: clean diff --git a/hack/sort-manifests.yaml.tmpl b/hack/sort-manifests.yaml.tmpl index 33b314d..52adb24 100644 --- a/hack/sort-manifests.yaml.tmpl +++ b/hack/sort-manifests.yaml.tmpl @@ -1,9 +1,18 @@ +{{- define "platform" -}} + - uri: https://github.com/superbrothers/ksort/releases/download/{{ env.Getenv "GIT_VERSION" }}/ksort-{{ .os }}-{{ .arch }}.zip + sha256: {{ . | tmpl.Inline "./dist/ksort-{{ .os }}-{{ .arch }}.zip" | file.Read | crypto.SHA256 }} + bin: ksort{{ if eq .os "windows" }}.exe{{ end }} + selector: + matchLabels: + os: {{ .os }} + arch: {{ .arch }} +{{- end -}} apiVersion: krew.googlecontainertools.github.com/v1alpha2 kind: Plugin metadata: name: sort-manifests spec: - version: {{ .Env.GIT_VERSION }} + version: {{ env.Getenv "GIT_VERSION" }} shortDescription: Sort manifest files in a proper order by Kind description: | When installing manifests, they should be sorted in a proper order by Kind. @@ -14,39 +23,9 @@ spec: using tiller.SortByKind() in Kubernetes Helm. homepage: https://github.com/superbrothers/ksort platforms: - - uri: https://github.com/superbrothers/ksort/releases/download/{{ .Env.GIT_VERSION }}/ksort-darwin-amd64.zip - sha256: {{ file.Read "./dist/ksort-darwin-amd64.zip" | crypto.SHA256 }} - bin: ksort - files: - - from: ksort - to: . - - from: LICENSE.txt - to: . - selector: - matchLabels: - os: darwin - arch: amd64 - - uri: https://github.com/superbrothers/ksort/releases/download/{{ .Env.GIT_VERSION }}/ksort-linux-amd64.zip - sha256: {{ file.Read "./dist/ksort-linux-amd64.zip" | crypto.SHA256 }} - bin: ksort - files: - - from: ksort - to: . - - from: LICENSE.txt - to: . - selector: - matchLabels: - os: linux - arch: amd64 - - uri: https://github.com/superbrothers/ksort/releases/download/{{ .Env.GIT_VERSION }}/ksort-windows-amd64.zip - sha256: {{ file.Read "./dist/ksort-windows-amd64.zip" | crypto.SHA256 }} - bin: ksort.exe - files: - - from: ksort.exe - to: . - - from: LICENSE.txt - to: . - selector: - matchLabels: - os: windows - arch: amd64 + {{ template "platform" (dict "os" "darwin" "arch" "amd64") }} + {{ template "platform" (dict "os" "darwin" "arch" "arm64") }} + {{ template "platform" (dict "os" "linux" "arch" "amd64") }} + {{ template "platform" (dict "os" "linux" "arch" "arm64") }} + {{ template "platform" (dict "os" "linux" "arch" "arm") }} + {{ template "platform" (dict "os" "windows" "arch" "amd64") }}