diff --git a/Makefile b/Makefile index 230fb3b..39b95cd 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,38 @@ -REPO =? github.com/crossplane-contrib/function-pkl -CONTAINER_IMAGE =? ghcr.io/crossplane-contrib/function-pkl +REPO ?= github.com/crossplane-contrib/function-pkl +CONTAINER_IMAGE ?= ghcr.io/crossplane-contrib/function-pkl # Target used for Pkl Package Releases TARGET =? $(shell git branch --show-current) +LATEST_CORE := $(shell git tag -l "crossplane.contrib@*.*.*" --sort=-v:refname | head -n 1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') +LATEST_EXAMPLE := $(shell git tag -l "crossplane.contrib.example@*.*.*" --sort=-v:refname | head -n 1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') +LATEST_XRD := $(shell git tag -l "crossplane.contrib.xrd@*.*.*" --sort=-v:refname | head -n 1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') + +# This Resolves the Dependencies and sets the versions of our packages to the Latest ones for the package in Git .PHONY: pkl-resolve pkl-resolve: - pkl project resolve ./pkl/*/ + pkl project resolve \ + -e REPOSITORY="$(REPO)" \ + -e CROSSPLANE_CONTRIB_VERSION="$(LATEST_CORE)" \ + -e CROSSPLANE_CONTRIB_EXAMPLE_VERSION="$(LATEST_EXAMPLE)" \ + -e CROSSPLANE_CONTRIB_XRD_VERSION="$(LATEST_XRD)" \ + ./pkl/*/ +# Ensures the TAG Variable is set. .PHONY: check-tag check-tag: @[ "${TAG}" ] || (echo "TAG is not specified" && exit 1) +# Packages all Projects with the latest tags for each before Pushing the one referenced in TAG .PHONY: pkl-release pkl-release: check-tag pkl-resolve - $(eval RELEASE_FILES := $(shell pkl project package ./pkl/*/ | grep ${TAG})) + $(eval RELEASE_FILES := $(shell \ + pkl project package \ + -e REPOSITORY="$(REPO)" \ + -e CROSSPLANE_CONTRIB_VERSION="$(LATEST_CORE)" \ + -e CROSSPLANE_CONTRIB_EXAMPLE_VERSION="$(LATEST_EXAMPLE)" \ + -e CROSSPLANE_CONTRIB_XRD_VERSION="$(LATEST_XRD)" \ + ./pkl/*/ | grep ${TAG})) @if [ -z "$(RELEASE_FILES)" ]; then \ echo "No release files found for tag ${TAG}."; \ exit 1; \ diff --git a/pkl/crossplane.contrib.example/PklProject b/pkl/crossplane.contrib.example/PklProject index ff5fe3a..8abf0d6 100644 --- a/pkl/crossplane.contrib.example/PklProject +++ b/pkl/crossplane.contrib.example/PklProject @@ -17,15 +17,18 @@ /// Templates for configuring [Kubernetes](https://kubernetes.io). amends "pkl:Project" +local repo = read?("env:REPOSITORY") ?? "github.com/crossplane-contrib/function-pkl" +local packageVersion: String = read?("env:CROSSPLANE_CONTRIB_EXAMPLE_VERSION") ?? "0.0.0" + package { name = "crossplane.contrib.example" authors { "Tim Geimer <32556895+Avarei@users.noreply.github.com>" } - version = "1.0.0" - baseUri = "package://pkg.pkl-lang.org/github.com/crossplane-contrib/function-pkl/\(name)" - packageZipUrl = "https://github.com/crossplane-contrib/function-pkl/releases/download/\(name)@\(version)/\(name)@\(version).zip" - sourceCode = "https://github.com/crossplane-contrib/function-pkl" + version = packageVersion + baseUri = "package://pkg.pkl-lang.org/\(repo)/\(name)" + packageZipUrl = "https://\(repo)/releases/download/\(name)@\(version)/\(name)@\(version).zip" + sourceCode = "https://\(repo)" license = "Apache-2.0" description = """ Example for using the [Composition Functions](https://docs.crossplane.io/latest/concepts/composition-functions/). @@ -36,7 +39,7 @@ dependencies { ["crossplane.contrib.xrd"] = import("../crossplane.contrib.xrd/PklProject") ["k8s"] { - uri = "package://pkg.pkl-lang.org/pkl-k8s/k8s@1.0.1" + uri = "package://pkg.pkl-lang.org/pkl-k8s/k8s@1.1.0" } ["k8s.contrib.crd"] { uri = "package://pkg.pkl-lang.org/pkl-pantry/k8s.contrib.crd@1.0.7" diff --git a/pkl/crossplane.contrib.example/PklProject.deps.json b/pkl/crossplane.contrib.example/PklProject.deps.json index 35ca7cd..84d9b93 100644 --- a/pkl/crossplane.contrib.example/PklProject.deps.json +++ b/pkl/crossplane.contrib.example/PklProject.deps.json @@ -45,9 +45,9 @@ }, "package://pkg.pkl-lang.org/pkl-k8s/k8s@1": { "type": "remote", - "uri": "projectpackage://pkg.pkl-lang.org/pkl-k8s/k8s@1.0.1", + "uri": "projectpackage://pkg.pkl-lang.org/pkl-k8s/k8s@1.1.0", "checksums": { - "sha256": "75c6d66d94c335417a3c502e107aaeadf7a60b4e1d34b2c979afe11193205a1a" + "sha256": "9ca6002419e405a19b517d506490b46be9279556b5ef2664be0e836df80535e5" } }, "package://pkg.pkl-lang.org/github.com/crossplane-contrib/function-pkl/crossplane.contrib.xrd@1": { diff --git a/pkl/crossplane.contrib.xrd/PklProject b/pkl/crossplane.contrib.xrd/PklProject index 4b0b1b4..d7db778 100644 --- a/pkl/crossplane.contrib.xrd/PklProject +++ b/pkl/crossplane.contrib.xrd/PklProject @@ -17,14 +17,15 @@ /// Templates for configuring [Kubernetes](https://kubernetes.io). amends "pkl:Project" -local repo = "github.com/crossplane-contrib/function-pkl" +local repo = read?("env:REPOSITORY") ?? "github.com/crossplane-contrib/function-pkl" +local packageVersion: String = read?("env:CROSSPLANE_CONTRIB_XRD_VERSION") ?? "0.0.0" package { name = "crossplane.contrib.xrd" authors { "Tim Geimer <32556895+Avarei@users.noreply.github.com>" } - version = "1.0.0" + version = packageVersion baseUri = "package://pkg.pkl-lang.org/\(repo)/\(name)" packageZipUrl = "https://\(repo)/releases/download/\(name)@\(version)/\(name)@\(version).zip" sourceCode = "https://\(repo)" @@ -43,5 +44,5 @@ dependencies { ["syntax"] { uri = "package://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.syntax@1.0.2" } ["openapiv3"] { uri = "package://pkg.pkl-lang.org/pkl-pantry/org.openapis.v3@2.1.1" } - ["k8s"] { uri = "package://pkg.pkl-lang.org/pkl-k8s/k8s@1.0.1" } + ["k8s"] { uri = "package://pkg.pkl-lang.org/pkl-k8s/k8s@1.1.0" } } diff --git a/pkl/crossplane.contrib.xrd/PklProject.deps.json b/pkl/crossplane.contrib.xrd/PklProject.deps.json index 83a1670..6119d55 100644 --- a/pkl/crossplane.contrib.xrd/PklProject.deps.json +++ b/pkl/crossplane.contrib.xrd/PklProject.deps.json @@ -38,9 +38,9 @@ }, "package://pkg.pkl-lang.org/pkl-k8s/k8s@1": { "type": "remote", - "uri": "projectpackage://pkg.pkl-lang.org/pkl-k8s/k8s@1.0.1", + "uri": "projectpackage://pkg.pkl-lang.org/pkl-k8s/k8s@1.1.0", "checksums": { - "sha256": "75c6d66d94c335417a3c502e107aaeadf7a60b4e1d34b2c979afe11193205a1a" + "sha256": "9ca6002419e405a19b517d506490b46be9279556b5ef2664be0e836df80535e5" } }, "package://pkg.pkl-lang.org/pkl-pantry/org.openapis.v3@2": { diff --git a/pkl/crossplane.contrib/PklProject b/pkl/crossplane.contrib/PklProject index f66a30c..7556d4b 100644 --- a/pkl/crossplane.contrib/PklProject +++ b/pkl/crossplane.contrib/PklProject @@ -17,15 +17,18 @@ /// Templates for configuring [Kubernetes](https://kubernetes.io). amends "pkl:Project" +local repo = read?("env:REPOSITORY") ?? "github.com/crossplane-contrib/function-pkl" +local packageVersion: String = read?("env:CROSSPLANE_CONTRIB_VERSION") ?? "0.0.0" + package { name = "crossplane.contrib" authors { "Tim Geimer <32556895+Avarei@users.noreply.github.com>" } - version = "1.0.0" - baseUri = "package://pkg.pkl-lang.org/github.com/crossplane-contrib/function-pkl/\(name)" - packageZipUrl = "https://github.com/crossplane-contrib/function-pkl/releases/download/\(name)@\(version)/\(name)@\(version).zip" - sourceCode = "https://github.com/crossplane-contrib/function-pkl" + version = packageVersion + baseUri = "package://pkg.pkl-lang.org/\(repo)/\(name)" + packageZipUrl = "https://\(repo)/releases/download/\(name)@\(version)/\(name)@\(version).zip" + sourceCode = "https://\(repo)" license = "Apache-2.0" description = """ Templates for reading and configuring [Composition Functions](https://docs.crossplane.io/latest/concepts/composition-functions/). @@ -33,6 +36,6 @@ package { } dependencies { ["k8s"] { - uri = "package://pkg.pkl-lang.org/pkl-k8s/k8s@1.0.1" + uri = "package://pkg.pkl-lang.org/pkl-k8s/k8s@1.1.0" } } diff --git a/pkl/crossplane.contrib/PklProject.deps.json b/pkl/crossplane.contrib/PklProject.deps.json index 3ede6e3..9a7a11a 100644 --- a/pkl/crossplane.contrib/PklProject.deps.json +++ b/pkl/crossplane.contrib/PklProject.deps.json @@ -3,9 +3,9 @@ "resolvedDependencies": { "package://pkg.pkl-lang.org/pkl-k8s/k8s@1": { "type": "remote", - "uri": "projectpackage://pkg.pkl-lang.org/pkl-k8s/k8s@1.0.1", + "uri": "projectpackage://pkg.pkl-lang.org/pkl-k8s/k8s@1.1.0", "checksums": { - "sha256": "75c6d66d94c335417a3c502e107aaeadf7a60b4e1d34b2c979afe11193205a1a" + "sha256": "9ca6002419e405a19b517d506490b46be9279556b5ef2664be0e836df80535e5" } } }