@@ -47,33 +47,57 @@ jobs:
4747 token : ${{ steps.app-token.outputs.token }}
4848 fetch-depth : 0
4949
50+ - name : Verify only project.yml was changed
51+ id : verify-files
52+ run : |
53+ FILES_CHANGED=$(curl -s -H "Authorization: token ${{ steps.app-token.outputs.token }}" \
54+ "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" | \
55+ jq -r '.[].filename')
56+
57+ if [ "$(echo "$FILES_CHANGED" | wc -l)" -ne 1 ] || [ "$FILES_CHANGED" != ".github/project.yml" ]; then
58+ echo "Warning: Expected only .github/project.yml to be changed, but found:"
59+ echo "$FILES_CHANGED"
60+ echo "Skipping release process."
61+ echo "should_release=false" >> $GITHUB_OUTPUT
62+ else
63+ echo "✓ Verified that only .github/project.yml was changed"
64+ echo "should_release=true" >> $GITHUB_OUTPUT
65+ fi
66+
5067 - name : Capture version before PR
68+ if : steps.verify-files.outputs.should_release == 'true'
5169 run : echo "PREVIOUS_VERSION=$(yq '.release.current-version' before/.github/project.yml)" >> $GITHUB_ENV
5270
5371 - name : Checkout current ref
72+ if : steps.verify-files.outputs.should_release == 'true'
5473 uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
5574 with :
5675 token : ${{ steps.app-token.outputs.token }}
5776 path : after
5877 fetch-depth : 0
5978
6079 - name : Capture current version
80+ if : steps.verify-files.outputs.should_release == 'true'
6181 run : echo "CURRENT_VERSION=$(yq '.release.current-version' after/.github/project.yml)" >> $GITHUB_ENV
6282
6383 - name : Setup Java
84+ if : steps.verify-files.outputs.should_release == 'true'
6485 uses : actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0
6586 with :
6687 java-version : ${{ env.JAVA_VERSION }}
6788 distribution : temurin
6889
6990 - name : Setup Gradle
91+ if : steps.verify-files.outputs.should_release == 'true'
7092 uses : gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
7193
7294 - name : Build artifacts
95+ if : steps.verify-files.outputs.should_release == 'true'
7396 working-directory : before
7497 run : ./gradlew --no-daemon -Pjava.version=${{ env.JAVA_VERSION }} publish
7598
7699 - name : Release
100+ if : steps.verify-files.outputs.should_release == 'true'
77101 working-directory : before
78102 env :
79103 JRELEASER_MAVENCENTRAL_USERNAME : ${{ secrets.CENTRAL_USERNAME }}
0 commit comments