diff --git a/scripts/Dockerfile b/scripts/Dockerfile new file mode 100644 index 0000000..dc097b4 --- /dev/null +++ b/scripts/Dockerfile @@ -0,0 +1,5 @@ +FROM bellsoft/liberica-openjdk-debian:11 + +RUN apt-get update && apt-get install --no-install-recommends -y \ + git \ + && rm -rf /var/lib/apt/lists/* diff --git a/scripts/bump-major.yml b/scripts/bump-major.yml new file mode 100644 index 0000000..09de116 --- /dev/null +++ b/scripts/bump-major.yml @@ -0,0 +1,21 @@ +--- +platform: linux + +image_resource: + type: registry-image + source: + repository: cfje/spring-cloud-bindings + +inputs: +- name: source + +caches: +- path: maven + +outputs: +- name: source + +run: + path: source/scripts/bump-version.sh + args: + - major diff --git a/scripts/bump-minor.yml b/scripts/bump-minor.yml new file mode 100644 index 0000000..e0e130a --- /dev/null +++ b/scripts/bump-minor.yml @@ -0,0 +1,21 @@ +--- +platform: linux + +image_resource: + type: registry-image + source: + repository: cfje/spring-cloud-bindings + +inputs: +- name: source + +caches: +- path: maven + +outputs: +- name: source + +run: + path: source/scripts/bump-version.sh + args: + - minor diff --git a/scripts/bump-patch.yml b/scripts/bump-patch.yml new file mode 100644 index 0000000..6ea1f3e --- /dev/null +++ b/scripts/bump-patch.yml @@ -0,0 +1,21 @@ +--- +platform: linux + +image_resource: + type: registry-image + source: + repository: cfje/spring-cloud-bindings + +inputs: +- name: source + +caches: +- path: maven + +outputs: +- name: source + +run: + path: source/scripts/bump-version.sh + args: + - patch diff --git a/scripts/bump-version.sh b/scripts/bump-version.sh new file mode 100755 index 0000000..67b4b35 --- /dev/null +++ b/scripts/bump-version.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +set -euo pipefail + +[[ -d "${PWD}"/maven && ! -d "${HOME}"/.m2 ]] && ln -s "${PWD}"/maven "${HOME}"/.m2 + +if [[ "$#" -ne 1 ]]; then + printf "%s [ major | minor | patch ]\n" "$(basename "$0")" + exit 1 +fi + +case "$1" in + major ) + printf "Bumping major\n" + VERSION_PATTERN='${parsedVersion.nextMajorVersion}.0.0-SNAPSHOT' + ;; + minor ) + printf "Bumping minor\n" + VERSION_PATTERN='${parsedVersion.majorVersion}.${parsedVersion.nextMinorVersion}.0-SNAPSHOT' + ;; + patch ) + printf "Bumping patch\n" + VERSION_PATTERN='${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.nextIncrementalVersion}-SNAPSHOT' + ;; + * ) + printf "Unknown bump type %s\n" "$1" + exit 1 + ;; +esac + +cd source + +./mvnw build-helper:parse-version versions:set -DgenerateBackupPoms=false -DnewVersion="${VERSION_PATTERN}" +VERSION=$(./mvnw --quiet help:evaluate -DforceStdout -Dexpression=project.version) + +git add pom.xml +git checkout -- . + +git \ + -c user.name='Paketo Robot' \ + -c user.email='robot@paketo.io' \ + commit \ + --signoff \ + --message "v${VERSION} Development" diff --git a/scripts/deploy.sh b/scripts/deploy.sh new file mode 100755 index 0000000..aafa960 --- /dev/null +++ b/scripts/deploy.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -euo pipefail + +[[ -d "${PWD}"/maven && ! -d "${HOME}"/.m2 ]] && ln -s "${PWD}"/maven "${HOME}"/.m2 + +REPOSITORY="${PWD}"/repository + +cd source + +./mvnw deploy -Dmaven.test.skip=true -DaltDeploymentRepository="local::default::file://${REPOSITORY}" diff --git a/scripts/deploy.yml b/scripts/deploy.yml new file mode 100644 index 0000000..a09dea4 --- /dev/null +++ b/scripts/deploy.yml @@ -0,0 +1,19 @@ +--- +platform: linux + +image_resource: + type: registry-image + source: + repository: cfje/spring-cloud-bindings + +inputs: +- name: source + +caches: +- path: maven + +outputs: +- name: repository + +run: + path: source/scripts/deploy.sh diff --git a/scripts/release-version.sh b/scripts/release-version.sh new file mode 100755 index 0000000..304b3cf --- /dev/null +++ b/scripts/release-version.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +set -euo pipefail + +[[ -d "${PWD}"/maven && ! -d "${HOME}"/.m2 ]] && ln -s "${PWD}"/maven "${HOME}"/.m2 + +cd source + +./mvnw versions:set -DremoveSnapshot=true -DgenerateBackupPoms=false +VERSION=$(./mvnw --quiet help:evaluate -DforceStdout -Dexpression=project.version) + +git add pom.xml +git checkout -- . + +git \ + -c user.name='Paketo Robot' \ + -c user.email='robot@paketo.io' \ + commit \ + --signoff \ + --message "v${VERSION} Release" + +echo -n "${VERSION}" > ../version/version diff --git a/scripts/release-version.yml b/scripts/release-version.yml new file mode 100644 index 0000000..4b0f797 --- /dev/null +++ b/scripts/release-version.yml @@ -0,0 +1,20 @@ +--- +platform: linux + +image_resource: + type: registry-image + source: + repository: cfje/spring-cloud-bindings + +inputs: +- name: source + +caches: +- path: maven + +outputs: +- name: source +- name: version + +run: + path: source/scripts/release-version.sh diff --git a/scripts/test.sh b/scripts/test.sh new file mode 100755 index 0000000..9ca0c07 --- /dev/null +++ b/scripts/test.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -euo pipefail + +[[ -d "${PWD}"/maven && ! -d "${HOME}"/.m2 ]] && ln -s "${PWD}"/maven "${HOME}"/.m2 + +cd source + +./mvnw test diff --git a/scripts/test.yml b/scripts/test.yml new file mode 100644 index 0000000..4ede712 --- /dev/null +++ b/scripts/test.yml @@ -0,0 +1,16 @@ +--- +platform: linux + +image_resource: + type: registry-image + source: + repository: cfje/spring-cloud-bindings + +inputs: +- name: source + +caches: +- path: maven + +run: + path: source/scripts/test.sh