Skip to content

Commit bfe1aac

Browse files
tomasz-tylenda-sonarsourceclaude
authored andcommitted
SONARJAVA-6185 Prepare Next Iteration: adjust for automated release (#5506)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 022b982 commit bfe1aac

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
@@ -15,36 +15,35 @@ jobs:
1515
pull-requests: write
1616
contents: write
1717

18-
env:
19-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20-
NEXT_VERSION: "${{ inputs.version }}-SNAPSHOT"
21-
2218
steps:
2319

2420
- name: Checkout Sources
2521
uses: actions/checkout@v4
2622

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

4646
- name: Summary
4747
run: |
48-
echo "Generated ${{steps.create-pr.outputs.url}}." >> $GITHUB_STEP_SUMMARY
49-
echo "New version set to ${NEXT_VERSION}." >> $GITHUB_STEP_SUMMARY
50-
echo "Tip: close and reopen the PR to trigger CI. " >> $GITHUB_STEP_SUMMARY
48+
echo "Generated ${{steps.create-pr.outputs.pull-request-url}}." >> $GITHUB_STEP_SUMMARY
49+
echo "New version set to ${{ steps.version.outputs.full-version }}." >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)