diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml new file mode 100644 index 000000000..71134e47b --- /dev/null +++ b/.github/workflows/automerge.yml @@ -0,0 +1,26 @@ +name: Auto Merge + +on: + pull_request_target: + types: + - labeled + - opened + - synchronize + - reopened + +jobs: + automerge: + runs-on: ubuntu-latest + if: contains(github.event.pull_request.labels.*.name, 'automerge') + steps: + - name: Auto-approve + uses: hmarr/auto-approve-action@d7bc15c388690c0334b233f552dcf10b043501d2 # v4 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Auto-merge + run: gh pr merge --auto --squash --delete-branch "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8a7f1319c..bbe5b9c44 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,9 +11,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout project - uses: actions/checkout@v6 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v6 - name: Setup Java - uses: actions/setup-java@v5 + uses: actions/setup-java@8617b2cce998314393c155b2c6db4d2b722b15be # v5 with: distribution: 'microsoft' java-version: '21' @@ -30,10 +30,10 @@ jobs: needs: [ sonar ] steps: - name: Checkout project - uses: actions/checkout@v6 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v6 - name: Setup Java - uses: actions/setup-java@v5 + uses: actions/setup-java@8617b2cce998314393c155b2c6db4d2b722b15be # v5 with: distribution: 'microsoft' java-version: '21' @@ -90,36 +90,42 @@ jobs: runs-on: ubuntu-latest needs: [ publish ] steps: - - name: Checkout Branch - uses: actions/checkout@v6 + uses: actions/checkout@b4ffde65f46336ab11d5ea33ade984223922a344 # v4.1.1 + - name: Setup Java - uses: actions/setup-java@v5 + uses: actions/setup-java@8617b2cce998314393c155b2c6db4d2b722b15be # v5 with: distribution: 'microsoft' java-version: '21' cache: 'maven' + - name: Configure Git user run: | git config user.email "actions@github.com" git config user.name "GitHub Actions" + - name: Get version from POM without SNAPSHOT run: | VERSION_PARTS=($(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | cut -d- -f1 | tr "." "\n")) echo "MAJOR=${VERSION_PARTS[0]}" >> $GITHUB_ENV echo "MINOR=${VERSION_PARTS[1]}" >> $GITHUB_ENV echo "PATCH=${VERSION_PARTS[2]}" >> $GITHUB_ENV + - name: Bump And Update POM Version to new Development version + id: bump_version run: | NEW_VERSION="$((MAJOR)).$((MINOR)).$((PATCH+1))-SNAPSHOT" echo "New development version is: $NEW_VERSION" mvn versions:set -DnewVersion=${NEW_VERSION} -DgenerateBackupPoms=false - - name: Commit files - run: | - git commit -m "[version bump] new dev version" -a + echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT - - name: Push Development Version to Branch - uses: ad-m/github-push-action@77c5b412c50b723d2a4fbc6d71fb5723bcd439aa + - name: Create Pull Request + uses: peter-evans/create-pull-request@6d6857d36972954561a903c4f05b07ce2ea451b3 # v6 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{github.event.release.target_commitish || 'main'}} + commit-message: "chore: bump version to ${{ steps.bump_version.outputs.new_version }}" + title: "chore: bump version to ${{ steps.bump_version.outputs.new_version }}" + body: "Bumps the version to the next development version." + branch: "chore/bump-version-${{ steps.bump_version.outputs.new_version }}" + base: ${{ github.event.release.target_commitish || 'main' }} + labels: automerge