Skip to content

Commit a320504

Browse files
Add scripts and workflow to update Spring Boot version
1 parent 0048f95 commit a320504

File tree

5 files changed

+53
-1
lines changed

5 files changed

+53
-1
lines changed

.github/workflows/continuous-integraion-workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ jobs:
2323
path: ~/.gradle/caches
2424
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
2525
- name: Build with Gradle
26-
run: ./gradlew check --continue
26+
run: ./gradlew check --continue
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Update Spring Boot Version
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '0 12 * * *' # Once per day at 12am UTC
7+
8+
jobs:
9+
update-spring-boot-version:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- name: Update Spring Boot Version
14+
run: ./upgrade-spring-boot-version.sh
15+
- uses: stefanzweifel/git-auto-commit-action@v4
16+
with:
17+
commit_message: "Update Spring Boot Version"

find-latest-minor-version.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
increment_version() {
4+
local version="$1"
5+
local last_digit=$(echo "$version" | rev | cut -d '.' -f 1 | rev)
6+
local incremented_digit=$((last_digit + 1))
7+
echo "${version%.*}.$incremented_digit"
8+
}
9+
10+
find_next_minor_version() {
11+
local current_version=$1
12+
local maven_url=$2
13+
local next_version=$(increment_version "$current_version")
14+
local url="$maven_url/$next_version/"
15+
local response=$(curl --write-out "%{http_code}\n" --silent --output /dev/null "$url")
16+
17+
if [ "$response" -eq 200 ]; then
18+
echo "$next_version"
19+
fi
20+
}

update-spring-boot-version.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
source ./find-latest-minor-version.sh
4+
source ./versions.properties
5+
6+
next_minor_version=$(find_next_minor_version "$springBootVersion" "https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-starter")
7+
8+
if [ -z "$next_minor_version" ]; then
9+
echo "No new minor Spring Boot version found"
10+
exit 0
11+
fi
12+
13+
sed -i '' -e "s/^\(springBootVersion\s*=\s*\).*$/\1$next_minor_version/" versions.properties
14+
bash ./sync-boot-version.sh "$next_minor_version"

versions.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
springBootVersion=3.1.1

0 commit comments

Comments
 (0)