From dc35d5c90f5f50e254c4ada45bc6f706877fc050 Mon Sep 17 00:00:00 2001 From: Leeroy Travis Date: Mon, 2 Oct 2023 07:15:21 +0000 Subject: [PATCH] Update workflows from templates. --- .github/bump-version.get.sh | 5 ++++- .github/bump-version.set.sh | 9 ++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/bump-version.get.sh b/.github/bump-version.get.sh index 8ad17d8..ed1cc8f 100755 --- a/.github/bump-version.get.sh +++ b/.github/bump-version.get.sh @@ -20,7 +20,7 @@ fi # Find the version files in this directory or its descendants, but don't recurse too deep. # This line must be kept in sync with "bump-version.set.sh". -VERSFILES=$(find . -maxdepth 3 ! -path ./.git/\* | grep -v /node_modules/ | grep -E '.*/(version|Cargo.toml|version.go|package.json|pom.xml|version.sbt)$') +VERSFILES=$(find . -maxdepth 3 ! -path ./.git/\* | grep -v /node_modules/ | grep -E '.*/(version|Cargo.toml|version.go|package.json|pom.xml|version.sbt|build.gradle.kts)$') # Do we have at least one? if [ -z "${VERSFILES}" ] ; then @@ -72,6 +72,9 @@ for FILE in ${VERSFILES} ; do version.sbt) VERS=$(sed -e 's/^[^"]*"//' -e 's/"$//' < "${FILE}") ;; + build.gradle.kts) + VERS=$(grep "^version.*=" < "${FILE}" | sed -e 's/^[^"]*"//' -e 's/"$//') + ;; *) echo "Can't parse '${FILE}' for version" 1>&2 exit 1 diff --git a/.github/bump-version.set.sh b/.github/bump-version.set.sh index d1801fb..4a2d650 100755 --- a/.github/bump-version.set.sh +++ b/.github/bump-version.set.sh @@ -35,7 +35,7 @@ fi # Find the version files in this directory or its descendants, but don't recurse too deep. # This line must be kept in sync with "bump-version.get.sh". -VERSFILES=$(find . -maxdepth 3 ! -path ./.git/\* | grep -v /node_modules/ | grep -E '.*/(version|Cargo.toml|version.go|package.json|pom.xml|version.sbt)$') +VERSFILES=$(find . -maxdepth 3 ! -path ./.git/\* | grep -v /node_modules/ | grep -E '.*/(version|Cargo.toml|version.go|package.json|pom.xml|version.sbt|build.gradle.kts)$') # Edit the version files. for FILE in ${VERSFILES} ; do @@ -100,6 +100,13 @@ for FILE in ${VERSFILES} ; do rm "${FILE}.tmp" ;; + build.gradle.kts) + # Replace -foo with -SNAPSHOT to be compatible with Java conventions. + JAVAVERS="${NEWVERS/-*/-SNAPSHOT}" + sed 's/^version = ".*"$/version = "'"${JAVAVERS}"'"/' "${FILE}" > "${FILE}.tmp" + mv "${FILE}.tmp" "${FILE}" + ;; + *) echo "Can't edit '${FILE}' with new version" 1>&2 exit 1