Add scripts and workflow to update Spring Boot version

This commit is contained in:
Marcus Da Coregio
2023-07-20 10:27:37 -03:00
parent 0048f95df0
commit a320504852
5 changed files with 53 additions and 1 deletions

View File

@@ -23,4 +23,4 @@ jobs:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
- name: Build with Gradle
run: ./gradlew check --continue
run: ./gradlew check --continue

View File

@@ -0,0 +1,17 @@
name: Update Spring Boot Version
on:
workflow_dispatch:
schedule:
- cron: '0 12 * * *' # Once per day at 12am UTC
jobs:
update-spring-boot-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Update Spring Boot Version
run: ./upgrade-spring-boot-version.sh
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Update Spring Boot Version"

20
find-latest-minor-version.sh Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/bash
increment_version() {
local version="$1"
local last_digit=$(echo "$version" | rev | cut -d '.' -f 1 | rev)
local incremented_digit=$((last_digit + 1))
echo "${version%.*}.$incremented_digit"
}
find_next_minor_version() {
local current_version=$1
local maven_url=$2
local next_version=$(increment_version "$current_version")
local url="$maven_url/$next_version/"
local response=$(curl --write-out "%{http_code}\n" --silent --output /dev/null "$url")
if [ "$response" -eq 200 ]; then
echo "$next_version"
fi
}

14
update-spring-boot-version.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
source ./find-latest-minor-version.sh
source ./versions.properties
next_minor_version=$(find_next_minor_version "$springBootVersion" "https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-starter")
if [ -z "$next_minor_version" ]; then
echo "No new minor Spring Boot version found"
exit 0
fi
sed -i '' -e "s/^\(springBootVersion\s*=\s*\).*$/\1$next_minor_version/" versions.properties
bash ./sync-boot-version.sh "$next_minor_version"

1
versions.properties Normal file
View File

@@ -0,0 +1 @@
springBootVersion=3.1.1