From 2b7e43d65e3aa244c8deb8d4fe24ab311406333a Mon Sep 17 00:00:00 2001 From: Alban Auzeill Date: Mon, 26 Oct 2020 19:22:54 +0100 Subject: [PATCH] Create a release script --- build.gradle | 6 +++++- release.sh | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100755 release.sh diff --git a/build.gradle b/build.gradle index 5c46a85..ba931f3 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,11 @@ plugins { } group 'org.example' -version '1.1-SNAPSHOT' +project.version '1.1-SNAPSHOT' + +if (project.hasProperty('releaseVersion')) { + project.version = project.releaseVersion +} repositories { mavenCentral() diff --git a/release.sh b/release.sh new file mode 100755 index 0000000..2287bef --- /dev/null +++ b/release.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +set -euo pipefail + +do_release() { + export CURRENT_VERSION="$(sed -rn "s/^project\.version '([^']*)'$/\1/p" build.gradle)" + echo "current version: ${CURRENT_VERSION}" + export RELEASE_VERSION="${CURRENT_VERSION/-SNAPSHOT/}" + echo "release version: ${RELEASE_VERSION}" + ( + graalvm + ./gradlew --no-daemon "-PreleaseVersion=${RELEASE_VERSION}" clean build + native-image -jar "build/libs/compare-directory-${RELEASE_VERSION}.jar" build/compare-directory + echo "Binary file: build/compare-directory is ready to be downloaded on" + echo "https://github.com/alban-auzeill/compare-directory/releases" + echo "to create the release: v${RELEASE_VERSION}" + echo + echo "Then build.gradle need to be prepared for next release." + ) +} + +do_release