@@ -11,20 +11,30 @@ permissions:
1111 contents : write
1212 pull-requests : write
1313
14+ # DO NOT RESTORE CACHE for critical release steps to prevent a (extremely unlikely) scenario
15+ # where a supply chain attack could be achieved due to poisoned cache
1416jobs :
1517 check-code :
1618 runs-on : ubuntu-latest
1719 timeout-minutes : 30
1820 steps :
1921 - uses : actions/checkout@v5
20-
22+
2123 - name : Set up JDK
2224 uses : actions/setup-java@v5
2325 with :
2426 java-version : ' 17'
2527 distribution : ' temurin'
26- cache : ' maven'
27-
28+
29+ # Try to reuse existing cache from check-build
30+ - name : Try restore Maven Cache
31+ uses : actions/cache/restore@v4
32+ with :
33+ path : ~/.m2/repository
34+ key : ${{ runner.os }}-mvn-build-${{ hashFiles('**/pom.xml') }}
35+ restore-keys : |
36+ ${{ runner.os }}-mvn-build-
37+
2838 - name : Build with Maven
2939 run : ./mvnw -B clean package -Pproduction -T2C
3040
@@ -54,31 +64,31 @@ jobs:
5464 upload_url : ${{ steps.create-release.outputs.upload_url }}
5565 steps :
5666 - uses : actions/checkout@v5
57-
67+
5868 - name : Configure Git
5969 run : |
6070 git config --global user.email "[email protected] " 6171 git config --global user.name "GitHub Actions"
62-
72+
6373 - name : Un-SNAP
6474 run : ./mvnw -B versions:set -DremoveSnapshot -DprocessAllModules -DgenerateBackupPoms=false
65-
75+
6676 - name : Get version
6777 id : version
6878 run : |
6979 version=$(../mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
7080 echo "release=$version" >> $GITHUB_OUTPUT
7181 echo "releasenumber=${version//[!0-9]/}" >> $GITHUB_OUTPUT
7282 working-directory : ${{ env.PRIMARY_MAVEN_MODULE }}
73-
83+
7484 - name : Commit and Push
7585 run : |
7686 git add -A
7787 git commit -m "Release ${{ steps.version.outputs.release }}"
7888 git push origin
7989 git tag v${{ steps.version.outputs.release }}
8090 git push origin --tags
81-
91+
8292 - name : Create Release
8393 id : create-release
8494 uses : shogo82148/actions-create-release@4661dc54f7b4b564074e9fbf73884d960de569a3 # v1
@@ -109,7 +119,7 @@ jobs:
109119 timeout-minutes : 60
110120 steps :
111121 - uses : actions/checkout@v5
112-
122+
113123 - name : Init Git and pull
114124 run : |
115125 git config --global user.email "[email protected] " @@ -125,7 +135,7 @@ jobs:
125135 server-password : PACKAGES_CENTRAL_TOKEN
126136 gpg-passphrase : MAVEN_GPG_PASSPHRASE
127137 gpg-private-key : ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Only import once
128-
138+
129139 - name : Publish to GitHub Packages Central
130140 run : ../mvnw -B deploy -P publish -DskipTests -DaltDeploymentRepository=github-central::https://maven.pkg.github.com/xdev-software/central
131141 working-directory : ${{ env.PRIMARY_MAVEN_MODULE }}
@@ -157,7 +167,7 @@ jobs:
157167 timeout-minutes : 15
158168 steps :
159169 - uses : actions/checkout@v5
160-
170+
161171 - name : Init Git and pull
162172 run : |
163173 git config --global user.email "[email protected] " @@ -169,7 +179,15 @@ jobs:
169179 with :
170180 java-version : ' 17'
171181 distribution : ' temurin'
172- cache : ' maven'
182+
183+ # Try to reuse existing cache from check-build
184+ - name : Try restore Maven Cache
185+ uses : actions/cache/restore@v4
186+ with :
187+ path : ~/.m2/repository
188+ key : ${{ runner.os }}-mvn-build-${{ hashFiles('**/pom.xml') }}
189+ restore-keys : |
190+ ${{ runner.os }}-mvn-build-
173191
174192 - name : Build site
175193 run : ../mvnw -B compile site -DskipTests -T2C
@@ -188,7 +206,7 @@ jobs:
188206 timeout-minutes : 10
189207 steps :
190208 - uses : actions/checkout@v5
191-
209+
192210 - name : Init Git and pull
193211 run : |
194212 git config --global user.email "[email protected] " @@ -203,7 +221,7 @@ jobs:
203221 git add -A
204222 git commit -m "Preparing for next development iteration"
205223 git push origin
206-
224+
207225 - name : pull-request
208226 env :
209227 GH_TOKEN : ${{ github.token }}
0 commit comments