diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d2b17a7..a6cb8e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,20 +28,9 @@ jobs: with: maven-version: 3.9.6 - - name: Cache Maven packages - uses: actions/cache@v3 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - - name: Build with Maven run: mvn -B package --file pom.xml - - name: Run tests - run: mvn clean test - test: name: Run tests runs-on: ubuntu-latest @@ -62,13 +51,5 @@ jobs: with: maven-version: 3.9.6 - - name: Cache Maven packages - uses: actions/cache@v3 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - - name: Run tests run: mvn clean test \ No newline at end of file diff --git a/.github/workflows/post-merge.yml b/.github/workflows/post-merge.yml index 363ba68..b86bc02 100644 --- a/.github/workflows/post-merge.yml +++ b/.github/workflows/post-merge.yml @@ -8,10 +8,13 @@ on: jobs: update-version: runs-on: ubuntu-latest + if: github.actor != 'github-actions[bot]' steps: - name: Checkout repository uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Set Up Java uses: actions/setup-java@v3 @@ -29,11 +32,23 @@ jobs: mvn versions:set -DnewVersion=$NEW_VERSION mvn versions:commit - - name: Commit and push changes + - name: Create new branch and commit changes run: | git config user.name "GitHub Actions Bot" git config user.email "actions@github.com" + git checkout -b update-version-${{ env.NEW_VERSION }} git add pom.xml git commit -m "Update project version to ${{ env.NEW_VERSION }}" - git pull --rebase - git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} HEAD:main + + - name: Push changes to new branch + run: | + git push origin update-version-${{ env.NEW_VERSION }} + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ secrets.GITHUB_TOKEN }} + title: "Update project version to ${{ env.NEW_VERSION }}" + body: "Automated version update by GitHub Actions." + branch: update-version-${{ env.NEW_VERSION }} + base: main \ No newline at end of file