diff --git a/.github/workflows/PrepareNextIteration.yml b/.github/workflows/PrepareNextIteration.yml index f07996702a..83c3f14248 100644 --- a/.github/workflows/PrepareNextIteration.yml +++ b/.github/workflows/PrepareNextIteration.yml @@ -20,36 +20,35 @@ jobs: pull-requests: write contents: write - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NEXT_VERSION: "${{ inputs.version }}-SNAPSHOT" - steps: - name: Checkout Sources uses: actions/checkout@v4 + - name: Normalize Version + id: version + env: + VERSION: ${{ inputs.version }} + run: | + if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+$ ]]; then + VERSION="${VERSION}.0" + fi + echo "full-version=${VERSION}-SNAPSHOT" >> $GITHUB_OUTPUT + - name: Update Version Number run: | - git config user.name "${GITHUB_ACTOR}" - git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" - git config --global core.autocrlf input - git config --global core.safecrlf true - BRANCH="gh-action/next-iteration.${{ github.run_id }}" - git checkout -b "${BRANCH}" - mvn versions:set -DgenerateBackupPoms=false -DnewVersion="${NEXT_VERSION}" - git commit -m 'Prepare next development iteration' -a - git push --set-upstream origin "${BRANCH}" - echo "branch=${BRANCH}" >> $GITHUB_OUTPUT + mvn versions:set -DgenerateBackupPoms=false -DnewVersion="${{ steps.version.outputs.full-version }}" - name: Create Pull Request + uses: SonarSource/release-github-actions/create-pull-request@v1 id: create-pr - run: | - URL=$(gh pr create --draft --base master --title "Prepare next development iteration ${NEXT_VERSION}" --body '') - echo "url=${URL}" >> $GITHUB_OUTPUT + with: + commit-message: "Prepare next development iteration ${{ steps.version.outputs.full-version }}" + title: "Prepare next development iteration ${{ steps.version.outputs.full-version }}" + branch: gh-action/next-iteration + branch-suffix: timestamp - name: Summary run: | - echo "Generated ${{steps.create-pr.outputs.url}}." >> $GITHUB_STEP_SUMMARY - echo "New version set to ${NEXT_VERSION}." >> $GITHUB_STEP_SUMMARY - echo "Tip: close and reopen the PR to trigger CI. " >> $GITHUB_STEP_SUMMARY + echo "Generated ${{steps.create-pr.outputs.pull-request-url}}." >> $GITHUB_STEP_SUMMARY + echo "New version set to ${{ steps.version.outputs.full-version }}." >> $GITHUB_STEP_SUMMARY