Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AAE-17877 skip saving maven cache on PRs #380

Merged
merged 12 commits into from
Nov 27, 2023
18 changes: 15 additions & 3 deletions .github/actions/maven-build-and-tag/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,10 @@ runs:
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
- uses: actions/cache/restore@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
wojciech-piotrowiak marked this conversation as resolved.
Show resolved Hide resolved

- name: Set up JDK
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13
Expand Down Expand Up @@ -229,3 +227,17 @@ runs:
run: |
git tag -a $VERSION -m "Release version $VERSION"
git push origin $VERSION

- name: Clean m2 cache
if: github.event_name == 'push'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also if the condition is changed this should be kept consistent

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

shell: bash
run: |
rm -fr ~/.m2/repository/org/activiti
rm -fr ~/.m2/repository/com/alfresco

- name: Save maven cache
uses: actions/cache/save@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
if: github.event_name == 'push'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't prevent saving cache for branches different than the default one if the caller workflow is configured to build also those

something like && github.event.repository.default_branch == github.ref_name should fix that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I think we want to keep the cache on maintenance branches, that's why keeping the logic checking event push makes more sense to me

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think we need to consider maintenance branches as well, and we usually don't configure the CI to build on feature branches, so it should not be a problem.

with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v5.0.0
v5.1.0
Loading