Skip to content

Commit 876ec35

Browse files
committed
Add milestone and label to update-next-boot-version.yml workflow
Signed-off-by: onobc <[email protected]>
1 parent 61b0803 commit 876ec35

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

.github/workflows/update-next-boot-version.yml

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ name: Update to next Spring Boot version
22

33
on:
44
workflow_dispatch:
5-
5+
inputs:
6+
base-branch:
7+
description: "Base branch to update (e.g. '1.2.x'). HOWEVER always use workflow from: main"
8+
required: true
9+
type: string
610
permissions:
711
contents: read
812

@@ -17,34 +21,39 @@ jobs:
1721
steps:
1822
- uses: actions/checkout@v6
1923
with:
24+
ref: ${{ inputs.base-branch }}
2025
token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
2126
- name: Set up Gradle w/ Java 17 (0.x)
22-
if: github.ref != 'refs/heads/main'
27+
if: inputs.base-branch == '1.2.x'
2328
uses: spring-io/spring-gradle-build-action@v2
2429
with:
2530
java-version: '17'
2631
distribution: 'temurin'
2732
- name: Set up Gradle w/ Java 25 (main)
28-
if: github.ref == 'refs/heads/main'
33+
if: inputs.base-branch != '1.2.x'
2934
uses: spring-io/spring-gradle-build-action@v2
3035
with:
3136
java-version: '25'
3237
distribution: 'liberica'
3338
- name: Update version and create PR
3439
env:
3540
GH_TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
36-
BRANCH: ${{ github.ref_name }}
41+
BASE_BRANCH: ${{ inputs.base-branch }}
3742
run: |
38-
git config user.name 'github-actions[bot]'
39-
git config user.email 'github-actions[bot]@users.noreply.github.com'
40-
4143
bootVersion=$(cat gradle/libs.versions.toml | grep "spring-boot = \"" | cut -d '"' -f2)
4244
echo "Current Spring Boot version is $bootVersion"
43-
45+
milestone=$(cat gradle.properties | grep "version=" | awk -F'=' '{print $2}')
46+
milestone="${milestone%-*}"
47+
echo "Current milestone is $milestone"
4448
workBranch="update-boot-$bootVersion"
45-
git checkout -b $workBranch
46-
./gradlew updateToNextBootSnapshotVersion
49+
echo "Work branch is $workBranch (based from $BASE_BRANCH)"
4750
51+
git config user.name 'github-actions[bot]'
52+
git config user.email 'github-actions[bot]@users.noreply.github.com'
53+
git fetch origin
54+
git checkout -b $workBranch origin/$BASE_BRANCH
55+
56+
./gradlew updateToNextBootSnapshotVersion
4857
bootVersion=$(cat gradle/libs.versions.toml | grep "spring-boot = \"" | cut -d '"' -f2)
4958
echo "Next Spring Boot version is $bootVersion"
5059

@@ -53,4 +62,6 @@ jobs:
5362

5463
gh pr create --title "Update Spring Boot to $bootVersion" \
5564
--body "Merge to update to next Spring Boot version." \
56-
--base $BRANCH
65+
--base $BASE_BRANCH \
66+
--label "type: dependency-upgrade" \
67+
--milestone $milestone

0 commit comments

Comments
 (0)