Skip to content

Commit db39dd2

Browse files
SONARJAVA-6185 Prepare Next Iteration: adjust for automated release (#5506)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6aa3655 commit db39dd2

1 file changed

Lines changed: 19 additions & 20 deletions

File tree

.github/workflows/PrepareNextIteration.yml

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,36 +20,35 @@ jobs:
2020
pull-requests: write
2121
contents: write
2222

23-
env:
24-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25-
NEXT_VERSION: "${{ inputs.version }}-SNAPSHOT"
26-
2723
steps:
2824

2925
- name: Checkout Sources
3026
uses: actions/checkout@v4
3127

28+
- name: Normalize Version
29+
id: version
30+
env:
31+
VERSION: ${{ inputs.version }}
32+
run: |
33+
if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+$ ]]; then
34+
VERSION="${VERSION}.0"
35+
fi
36+
echo "full-version=${VERSION}-SNAPSHOT" >> $GITHUB_OUTPUT
37+
3238
- name: Update Version Number
3339
run: |
34-
git config user.name "${GITHUB_ACTOR}"
35-
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
36-
git config --global core.autocrlf input
37-
git config --global core.safecrlf true
38-
BRANCH="gh-action/next-iteration.${{ github.run_id }}"
39-
git checkout -b "${BRANCH}"
40-
mvn versions:set -DgenerateBackupPoms=false -DnewVersion="${NEXT_VERSION}"
41-
git commit -m 'Prepare next development iteration' -a
42-
git push --set-upstream origin "${BRANCH}"
43-
echo "branch=${BRANCH}" >> $GITHUB_OUTPUT
40+
mvn versions:set -DgenerateBackupPoms=false -DnewVersion="${{ steps.version.outputs.full-version }}"
4441
4542
- name: Create Pull Request
43+
uses: SonarSource/release-github-actions/create-pull-request@v1
4644
id: create-pr
47-
run: |
48-
URL=$(gh pr create --draft --base master --title "Prepare next development iteration ${NEXT_VERSION}" --body '')
49-
echo "url=${URL}" >> $GITHUB_OUTPUT
45+
with:
46+
commit-message: "Prepare next development iteration ${{ steps.version.outputs.full-version }}"
47+
title: "Prepare next development iteration ${{ steps.version.outputs.full-version }}"
48+
branch: gh-action/next-iteration
49+
branch-suffix: timestamp
5050

5151
- name: Summary
5252
run: |
53-
echo "Generated ${{steps.create-pr.outputs.url}}." >> $GITHUB_STEP_SUMMARY
54-
echo "New version set to ${NEXT_VERSION}." >> $GITHUB_STEP_SUMMARY
55-
echo "Tip: close and reopen the PR to trigger CI. " >> $GITHUB_STEP_SUMMARY
53+
echo "Generated ${{steps.create-pr.outputs.pull-request-url}}." >> $GITHUB_STEP_SUMMARY
54+
echo "New version set to ${{ steps.version.outputs.full-version }}." >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)