-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (41 loc) · 1.59 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
LIBRARY_VERSION:=0.5.2
PROVIDER_VERSION:=0.24.0
JSONNET_BIN:=jrsonnet
CROSSPLANE?=crossplane
REGISTRY?=ghcr.io
SHELL:=/bin/bash
GENERATOR_DEPTHS:=$(shell find generator -type f)
.PHONY: build
build: grafanaplane/zz packages docs
.PHONY: push
push: push_packages
grafanaplane: grafanaplane/zz
generator/crds.yaml:
cd generator && \
curl -sLO https://github.com/grafana/crossplane-provider-grafana/releases/download/v$(PROVIDER_VERSION)/crds.yaml
grafanaplane/zz: $(GENERATOR_DEPTHS)
rm -rf grafanaplane/zz && \
FILES=$$($(JSONNET_BIN) \
-s 1000 \
-S -c -m grafanaplane \
-J generator/vendor \
-A 'version=$(LIBRARY_VERSION)-$(PROVIDER_VERSION)' \
generator/main.libsonnet) && \
xargs -n1 jsonnetfmt -i <<< "$${FILES}"
packages: $(GENERATOR_DEPTHS)
rm -rf packages && \
$(JSONNET_BIN) -S -m packages -c -J generator/vendor generator/packages.libsonnet
packages=$(wildcard packages/*)
push_packages: packages $(packages)
rm -rf output && mkdir -p output/
$(foreach pkg,$(packages),$(CROSSPLANE) xpkg build --package-root=$(pkg) --package-file=output/$(patsubst packages/%,%,$(pkg)).xpkg;)
$(foreach pkg,$(packages),$(CROSSPLANE) xpkg push -f output/$(patsubst packages/%,%,$(pkg)).xpkg $(REGISTRY)/grafana/crossplane/$(patsubst packages/%,%,$(pkg)):$(LIBRARY_VERSION)-$(PROVIDER_VERSION);)
docs: $(shell find grafanaplane/ -type f)
rm -rf docs/
$(JSONNET_BIN) \
-J generator/vendor \
-S -c -m docs \
-e '(import "github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet").render(import "grafanaplane/main.libsonnet")'
.PHONY: tag
tag:
git tag $(LIBRARY_VERSION)-$(PROVIDER_VERSION)