Skip to content

Commit c4a1fa1

Browse files
Merge pull request #49 from SelahattinSert/task/fix-pipeline-issues
Update and fix workflows, optimize CI pipeline
2 parents 58c2443 + c9f487b commit c4a1fa1

File tree

2 files changed

+18
-22
lines changed

2 files changed

+18
-22
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,9 @@ jobs:
2828
with:
2929
maven-version: 3.9.6
3030

31-
- name: Cache Maven packages
32-
uses: actions/cache@v3
33-
with:
34-
path: ~/.m2/repository
35-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
36-
restore-keys: |
37-
${{ runner.os }}-maven-
38-
3931
- name: Build with Maven
4032
run: mvn -B package --file pom.xml
4133

42-
- name: Run tests
43-
run: mvn clean test
44-
4534
test:
4635
name: Run tests
4736
runs-on: ubuntu-latest
@@ -62,13 +51,5 @@ jobs:
6251
with:
6352
maven-version: 3.9.6
6453

65-
- name: Cache Maven packages
66-
uses: actions/cache@v3
67-
with:
68-
path: ~/.m2/repository
69-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
70-
restore-keys: |
71-
${{ runner.os }}-maven-
72-
7354
- name: Run tests
7455
run: mvn clean test

.github/workflows/post-merge.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@ on:
88
jobs:
99
update-version:
1010
runs-on: ubuntu-latest
11+
if: github.actor != 'github-actions[bot]'
1112

1213
steps:
1314
- name: Checkout repository
1415
uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
1518

1619
- name: Set Up Java
1720
uses: actions/setup-java@v3
@@ -29,11 +32,23 @@ jobs:
2932
mvn versions:set -DnewVersion=$NEW_VERSION
3033
mvn versions:commit
3134
32-
- name: Commit and push changes
35+
- name: Create new branch and commit changes
3336
run: |
3437
git config user.name "GitHub Actions Bot"
3538
git config user.email "actions@github.com"
39+
git checkout -b update-version-${{ env.NEW_VERSION }}
3640
git add pom.xml
3741
git commit -m "Update project version to ${{ env.NEW_VERSION }}"
38-
git pull --rebase
39-
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} HEAD:main
42+
43+
- name: Push changes to new branch
44+
run: |
45+
git push origin update-version-${{ env.NEW_VERSION }}
46+
47+
- name: Create Pull Request
48+
uses: peter-evans/create-pull-request@v5
49+
with:
50+
token: ${{ secrets.GITHUB_TOKEN }}
51+
title: "Update project version to ${{ env.NEW_VERSION }}"
52+
body: "Automated version update by GitHub Actions."
53+
branch: update-version-${{ env.NEW_VERSION }}
54+
base: main

0 commit comments

Comments
 (0)