@@ -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 :
19- - uses : actions/checkout@v4
20-
21+ - uses : actions/checkout@v5
22+
2123 - name : Set up JDK
22- uses : actions/setup-java@v4
24+ 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
@@ -51,45 +61,37 @@ jobs:
5161 needs : [check-code]
5262 timeout-minutes : 10
5363 outputs :
54- upload_url : ${{ steps.create_release .outputs.upload_url }}
64+ upload_url : ${{ steps.create-release .outputs.upload_url }}
5565 steps :
56- - uses : actions/checkout@v4
57-
66+ - uses : actions/checkout@v5
67+
5868 - name : Configure Git
5969 run : |
6070 git config --global user.email "actions@github.com"
6171 git config --global user.name "GitHub Actions"
62-
72+
6373 - name : Un-SNAP
64- run : |
65- mvnwPath=$(readlink -f ./mvnw)
66- modules=("") # root
67- modules+=($(grep -oP '(?<=<module>)[^<]+' 'pom.xml'))
68- for i in "${modules[@]}"
69- do
70- echo "Processing $i/pom.xml"
71- (cd "$i" && $mvnwPath -B versions:set -DremoveSnapshot -DgenerateBackupPoms=false)
72- done
73-
74+ run : ./mvnw -B versions:set -DremoveSnapshot -DprocessAllModules -DgenerateBackupPoms=false
75+
7476 - name : Get version
7577 id : version
7678 run : |
7779 version=$(../mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
7880 echo "release=$version" >> $GITHUB_OUTPUT
7981 echo "releasenumber=${version//[!0-9]/}" >> $GITHUB_OUTPUT
8082 working-directory : ${{ env.PRIMARY_MAVEN_MODULE }}
81-
83+
8284 - name : Commit and Push
8385 run : |
8486 git add -A
8587 git commit -m "Release ${{ steps.version.outputs.release }}"
8688 git push origin
8789 git tag v${{ steps.version.outputs.release }}
8890 git push origin --tags
89-
91+
9092 - name : Create Release
91- id : create_release
92- uses : shogo82148/actions-create-release@4661dc54f7b4b564074e9fbf73884d960de569a3 # v1
93+ id : create-release
94+ uses : shogo82148/actions-create-release@7b89596097b26731bda0852f1504f813499079ee # v1
9395 with :
9496 tag_name : v${{ steps.version.outputs.release }}
9597 release_name : v${{ steps.version.outputs.release }}
@@ -116,27 +118,43 @@ jobs:
116118 needs : [prepare-release]
117119 timeout-minutes : 60
118120 steps :
119- - uses : actions/checkout@v4
120-
121+ - uses : actions/checkout@v5
122+
121123 - name : Init Git and pull
122124 run : |
123125 git config --global user.email "actions@github.com"
124126 git config --global user.name "GitHub Actions"
125127 git pull
126-
128+
127129 - name : Set up JDK
128- uses : actions/setup-java@v4
129- with : # running setup-java again overwrites the settings.xml
130+ uses : actions/setup-java@v5
131+ with : # running setup-java overwrites the settings.xml
132+ distribution : ' temurin'
130133 java-version : ' 17'
134+ server-id : github-central
135+ server-password : PACKAGES_CENTRAL_TOKEN
136+ gpg-passphrase : MAVEN_GPG_PASSPHRASE
137+ gpg-private-key : ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Only import once
138+
139+ - name : Publish to GitHub Packages Central
140+ run : ../mvnw -B deploy -P publish -DskipTests -DaltDeploymentRepository=github-central::https://maven.pkg.github.com/xdev-software/central
141+ working-directory : ${{ env.PRIMARY_MAVEN_MODULE }}
142+ env :
143+ PACKAGES_CENTRAL_TOKEN : ${{ secrets.PACKAGES_CENTRAL_TOKEN }}
144+ MAVEN_GPG_PASSPHRASE : ${{ secrets.MAVEN_GPG_PASSPHRASE }}
145+
146+ - name : Set up JDK
147+ uses : actions/setup-java@v5
148+ with : # running setup-java again overwrites the settings.xml
131149 distribution : ' temurin'
150+ java-version : ' 17'
132151 server-id : sonatype-central-portal
133152 server-username : MAVEN_CENTRAL_USERNAME
134153 server-password : MAVEN_CENTRAL_TOKEN
135154 gpg-passphrase : MAVEN_GPG_PASSPHRASE
136- gpg-private-key : ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
137155
138156 - name : Publish to Central Portal
139- run : ../mvnw -B deploy -P publish-sonatype-central-portal -DskipTests
157+ run : ../mvnw -B deploy -P publish,publish -sonatype-central-portal -DskipTests
140158 env :
141159 MAVEN_CENTRAL_USERNAME : ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_USERNAME }}
142160 MAVEN_CENTRAL_TOKEN : ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_TOKEN }}
@@ -148,20 +166,28 @@ jobs:
148166 needs : [prepare-release]
149167 timeout-minutes : 15
150168 steps :
151- - uses : actions/checkout@v4
152-
169+ - uses : actions/checkout@v5
170+
153171 - name : Init Git and pull
154172 run : |
155173 git config --global user.email "actions@github.com"
156174 git config --global user.name "GitHub Actions"
157175 git pull
158176
159177 - name : Setup - Java
160- uses : actions/setup-java@v4
178+ uses : actions/setup-java@v5
161179 with :
162180 java-version : ' 17'
163181 distribution : ' temurin'
164- 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-
165191
166192 - name : Build site
167193 run : ../mvnw -B compile site -DskipTests -T2C
@@ -179,31 +205,23 @@ jobs:
179205 needs : [publish-maven]
180206 timeout-minutes : 10
181207 steps :
182- - uses : actions/checkout@v4
183-
208+ - uses : actions/checkout@v5
209+
184210 - name : Init Git and pull
185211 run : |
186212 git config --global user.email "actions@github.com"
187213 git config --global user.name "GitHub Actions"
188214 git pull
189215
190216 - name : Inc Version and SNAP
191- run : |
192- mvnwPath=$(readlink -f ./mvnw)
193- modules=("") # root
194- modules+=($(grep -oP '(?<=<module>)[^<]+' 'pom.xml'))
195- for i in "${modules[@]}"
196- do
197- echo "Processing $i/pom.xml"
198- (cd "$i" && $mvnwPath -B build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} -DgenerateBackupPoms=false -DnextSnapshot=true -DupdateMatchingVersions=false)
199- done
217+ run : ./mvnw -B versions:set -DnextSnapshot -DprocessAllModules -DgenerateBackupPoms=false
200218
201219 - name : Git Commit and Push
202220 run : |
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